Hello,
I am facing one problem while using littlefs + spif.
i am able to store data in file if i close the file after writing data in it. And on next reset i am able to append/write/read data to/from previously created file.
for example,
int main()
{
int err,data_bytes;
err = fs.mount(bd);
if (err) {
err = fs.reformat(bd);
}
FILE *f = fopen("/fs/numbers.txt", "a+");
if (!f) {
f = fopen("/fs/numbers.txt", "w+");
}
for(byte=0; byte<10 ; byte++){ // will append data to file
fputc('U',f);
}
fclose();
}
this example works fine if i closes file at the end, and upon next reset it appends new data.
Now my requirement is that i want to keep my file open for all the time but don’t want to close it, So is there any way to update data in flash without calling fclose() every time.
In littlefs readme it says that
// Remember that storage may not be updated until the file
// is closed successfully
fclose(f);
Thanks in Advance.