I saved some data in a binary file using C++. Two minutes after the data was saved, the power to the computer was suddenly cut off. When I restarted the computer the data was corrupted. When I read the binary file, all of the values were 0
, which is certainly not what I had written to the file.
Is it possible that the sudden computer power down corrupted the data in my files? Or is it so that this cannot be the case because data once written and saved to disk does not corrupt, even in the event of sudden power down.? If it is the latter, then I will have to start a detailed investigation of the issue, but I really don't suspect anything else could have gone wrong. The program is very simple and has been in use for 2 years, and this is the first time I am seeing any data corruption of files written using the program.
P.S. The file had indeed finished saving. The program that saved the file manages file i/o correctly - it closes the file after it is finished writing it. Also, the program was not even running when the power down happened. This happened On Windows 8.1.