emcvs
1
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.
Juraj
2
seek
one byte less than the file size before writing new data.
1 Like
emcvs
3
thanks for answering. i did not know how to use seek, since i'm a newbie
dataFile.seek(dataFile.size()-1);
dataFile.print(String(timeExtended));
seems not to be working for me, can you please elaborate
Juraj
4
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?
1 Like
emcvs
5
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
Juraj
6
good to know. it is because FILE_WRITE has O_APPEND and that seeks to the end on open
system
Closed
7
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.