Hi all,
i am using Littlefs in nrf_connect_sdk,
how can i flush the contents of file
Regards
Tushar
Hi all,
i am using Littlefs in nrf_connect_sdk,
how can i flush the contents of file
Regards
Tushar
Hi, Torbjorn,
I'am running ../zephyr/samples/subsys/fs/littlefs example
is there any way i can empty the file once after reading it
Regards
Tushar
Hi Tushar
You mean you want to delete the file entirely, or you just want to clear all the content of the file?
Best regards
Torbjørn
Hi Torbjorn,
i want to clear the contents of file
Regards
Tushar
Hi Tushar
There is no function for clearing a file directly.
Either you would have to use fs_write() to overwrite the existing data with 0's, or you could possibly use the fs_truncate() function twice. One time to reduce the size of the file to 0, and a second time to increase the size back to the original size (but now filled with 0's only).
As a side note, ignore my previous suggestion to use the lfs_file_sync() method, instead the fs_sync() method should be used for flushing the data buffers.
Best regards
Torbjørn