I'm keeping a time log of some process plus letting user to extend the time of that process.
I'm using ";" as end of line.
This is the algo
Log initial time -> [processing] -> extend time? -> if yes -> Log Additional time + ";"-> if no -> add";"
the problem is when while on the processing and the reset button was pressed (emergency stop),
the end of line char ( ; ) will not be reached.
my counter measure is to add end of line char ( ; ) on the initial log of time.
Log initial time + ";" -> [processing] -> extend time? -> if yes -> delete ";", Log Additional time + ";" -> if no -> continue;
How to delete ";" (which will be the last char of the .txt file) from sd card, if the user intends to extend time?
Thanks for answering.
seek one byte less than the file size before writing new data.
thanks for answering. i did not know how to use seek, since i'm a newbie
seems not to be working for me, can you please elaborate
yes it is how I would do it. I never need it.
what does it do? appends at the end of file?
is the file opened with FILE_WRITE?
Thank you for the inputs.
I made it work by changing FILE_WRITE to O_RDWR
Reference: SD: seek and write seems not working! - #6 by cattledog
good to know. it is because FILE_WRITE has O_APPEND and that seeks to the end on open
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.