User forums > Help
Codeblocks overwrote main.cpp file with a blank line.
Gimbo:
Hello everybody, i was working on a project and it was almost finished, but suddently laptop battery died and my laptop was brutally shutted down.
After i restarted the pc i noticed that my main.cpp was overwritten with a blank line. Is there any way to recover the old version of my main.cpp?
Please help me, this is very frustrating
stahta01:
Code::Blocks normally copies the file before overwriting it.
Look for a file using an text editor with about the same name; but, with another extension.
Inside the same folder would be where I suggest looking.
Others might have more detail information.
Tim S.
sodev:
Did you ever save the file? Because if not nothing got overwritten but the file was empty all the time and there is nothing to restore.
Gimbo:
--- Quote from: stahta01 on October 04, 2019, 11:15:11 pm ---Code::Blocks normally copies the file before overwriting it.
Look for a file using an text editor with about the same name; but, with another extension.
Inside the same folder would be where I suggest looking.
Others might have more detail information.
Tim S.
--- End quote ---
In the project folder i get only main.o and main.cpp files
--- Quote from: sodev on October 04, 2019, 11:19:34 pm ---Did you ever save the file? Because if not nothing got overwritten but the file was empty all the time and there is nothing to restore.
--- End quote ---
Yes, I was working on this project since few day.
Miguel Gimenez:
C::B first saves the file (p.e. Test.cpp) in the same folder with the name ending in ".temp". If Test.cpp.temp saves OK then C:B try renaming it as Test.cpp, removing the previous file if it existed. If this operation fails, the Test.cpp.temp file is renamed as Test.cpp.save-failed.
If there is neither a .temp file nor a .save-failed file then I suspect a filesystem failure.
Reference: src\sdk\filemanager.cpp -> FileManager::Save() method
Navigation
[0] Message Index
[#] Next page
Go to full version