How to delete the last char of .txt from SD

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.

1 Like

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?