Hi,
I am working on a project which involves arduino mega 2560, esp8266 and SD card module.
The idea is, a user can send some text commands to the device through the esp8266 module. The esp8266 is interfaced through serial with Arduino.
Some of these text commands will be some sort of schedule or anything else. On the SD card they are being stored as distinct lines with newlines at the end. So after each '\n' the there might be another newline or "End of File".
I have been able to successfully append the texts on the card and read them char by char.
But now I need to find a text line in the file and need to replace it with another string or simply delete it (which can be also another replace operation with just a newline character).
So far I could come up with is the SdFile::curPosition(), seekset() and similar methods.
I have been also able to see which position in the file i m reading though I m not sure how to manipulate these methods to replace or delete chars from the text file.
I am using the sdfat lib because I also have some methods that allows me to wipe or format the SDcard from the micro controller which is a needed feature for my project.
Have anyone done it? Any code example or advice is appreciated.
Thanks.