Hi, I'm currently making a project where by I need to record between 10 and 30 integer values. I need to record these to an SD card. I'm currently using the UTFT_tinyFAT and tinyFAT libraries, as the SD card reader I have is built into a Touch screen display unit. The problem I'm having is that I cant see any way to write to a file and over write what is already there using this library, I can see how to write a new line using file.WriteLn(text), but basically I want to replace the content of the file every time the data values change, as I have no need to record the change, just the current values.
To give a bit of background my project will record changes in values, in response to input on the touchscreen and record them to the SD card. I want the project to record these values everyday, and I have an RTC and was thinking of creating a new file on the SD card each midnight, and then write the current values to that file, then during the next 24 hours the values within the file would be updated whenever they need to, and at the next midnight a new file would be created etc. etc.
Can anyone give me some advice on the best way to do this. The only thing I have come up with so far is to delete the file and create a new one everytime the values change, but this doesnt seem the best way, as if power was cut at the wrong time it could lead to the file being deleted and the device powering off before the new file is written. Also it would be better if I could just read and write an array of integers, instead of having to turn everything into Strings and back again!
Hopefully this makes sence!