Hello,
I have an issue of SPIFFS read-write operation. I open file in read-write mode to write data into file, then try to read data without closing the file, but read operation fails with return of -1. But when I follow same procedure with adding extra step of closing file after file write and then again open file in read-write mode and then file read operation works perfectly.
Does anybody have came across same problem..? Can anybody explain it..?
Thanks.
SPIFFS... Have to close file to read after write operation..?
-
- Posts: 62
- Joined: Wed Apr 19, 2017 6:35 am
Re: SPIFFS... Have to close file to read after write operation..?
You have to use fseek() to position the file pointer. If you write to the empty file, the file pointer will be at EOF after fwrite.
https://www.tutorialspoint.com/c_standa ... _fseek.htm
https://www.tutorialspoint.com/c_standa ... _fseek.htm
-
- Posts: 62
- Joined: Wed Apr 19, 2017 6:35 am
Re: SPIFFS... Have to close file to read after write operation..?
Ohh yeah... Correct. Thanks for early reply.
Who is online
Users browsing this forum: Bing [Bot] and 169 guests