Good morning all, My goal is the following: I want to fill a text file every 5ms (with a timer). Below you will find the function code. Code link
In normal operation, this function works correctly as long as I go into the "REGUL_STATE_EG" state and exit it correctly. While in the "REGUL_STATE_EG" state, my file is filling correctly with no problem and on output, I get a file that is filling correctly too. Here is the problem : As soon as I go into the "REGUL_STATE_EG" state and a power cut occurs at some point while I'm still in that state, the data that was added to this file before the power cut occurred get totally lost and I get an empty file and I don't know why.
In theory, the data written in the file before the power cut should be saved because each time, there is opening and closing of the file but in my case I recover an empty file. There is nothing in it.
Thank you in advance for your help.