I'm writing a logging program for a microcontroller with OS Linux. There is also a calculation function, in which those results shall stored on HDD and loaded when the logger is restarted.
My problem is, when I unplug the µC from current meanwhile the µC is overwritting some data, the overwritten data could be lost.
So how I may overwrite some data, but ensure whether the overwritten data or the written data is consistent if a unplug meanwhile the µC is overwritting happens?
Programming language is C++, so I would be in love if there is an boost library or even better a stl type.