Ai-Thinker-Open / GPRS_C_SDK

Ai-Thinker A9/A9G GPRS (with GPS(A9G)) module C development SDK
https://ai-thinker-open.github.io/GPRS_C_SDK_DOC
MIT License
449 stars 236 forks source link

"FS_O_APPEND" doesn't work. The file remains empty!! #187

Closed Bhavikjp closed 6 years ago

Bhavikjp commented 6 years ago

Hello, I have used A9G GPS/GPRS module. Now, I want to save/write/store multiple GPS data into the same file on the memory card/TF card. FS_O_RDWR function works very well. But it overwrites data every time. I have merged code and used FS_O_APPEND instead of FS_O_RDWR for appending data into the same file. but APPEND function doesn't work. It stores nothing in the file.

Code for storing data is like this:

appendfun

Can you please suggest a way to solve it out

Thanks!!

punee995 commented 6 years ago

you're doing it wrong! you still need write to file so.

FS_O_CREATE | FS_O_RDWR | FS_O_APPEND

Bhavikjp commented 6 years ago

Hi @punee995 , the thing is i want to add data to one file itself but file carries only one data. Hence append is not working. Can you suggest some other way. Help would be appreciated.

punee995 commented 6 years ago

did you tried my last comment!

Bhavikjp commented 6 years ago

@punee995, Yes i did. @neutree Any Suggestion? i want to add data to one file itself but file carries only one data. Hence append is not working. Can you suggest some other way. Thanks!!

punee995 commented 6 years ago

this is the only way to append file as i told you earlier and i've tested it.

FS_O_CREATE | FS_O_RDWR | FS_O_APPEND

Bhavikjp commented 6 years ago

FS_O_CREATE | FS_O_RDWR | FS_O_APPEND It works now. Thanks @punee995