User forums > Help

CodeBlocks Crashed and Deleted The Contents of My File? (windows 8)

(1/2) > >>

furrare:
Hello! I've been using CodeBlocks throughout the year now and rarely have had any issues with it but it just crashed on me unexpectedly while I was trying to exit the program. When I went to retrieve my .c file there doesn't appear to be any content in there.  :'( File size is not zero though and makes it seem like something is there. I opened up the .c file in notepad++ and got a bunch of NUL values.  Can my code be salvaged in any way? =/ Thanks in advance.

[Edit: Removed excessive space / line feeds in post.]

oBFusCATed:
Yes, check it out of your VCS. If you're not using VCS then you've learned a lesson and you would start using one with your next project.

Are you using some strange encoding, notepad++ cannot detect?

BlueHazzard:
you can try to look at it with some hex editor and try to recover the content. If you are using some shitty encoding like utf-16 (standard on windows) it is possible that you shifted some byte somewhere.
There should also be some recover tools out there in the Internet...

greetings

MortenMacFly:
You should also check with an explorer if you have backup files. C::B first saves the new file to a temporary, then renames the old one, renames the temporary an finally removed the old one. So chances are that you've the old content in a back file.

thomas:

--- Quote from: MortenMacFly on October 25, 2015, 09:28:33 am ---You should also check with an explorer if you have backup files. C::B first saves the new file to a temporary, then renames the old one, renames the temporary an finally removed the old one. So chances are that you've the old content in a back file.

--- End quote ---
This.

Code::Blocks is extremely careful never to overwrite a file and to always make sure that data cannot be lost. Unless someone played with the save function and broke something (very unlikely!), you can only lose data if you save your files in a "special" location such as Program Files . Note that Windows (starting with Vista, but getting worse with every release thereafter) is outright lying to you sometimes.

Sadly, there is nothing from a program's point of view that can be done if the operating system tells you "Alright, everything is OK" and you later find out that you have been lied to and the operating system silently deleted the file after you closed the handle. The only thing you can do as a user is to avoid locations where Windows will apply its super smart behavior.

Navigation

[0] Message Index

[#] Next page

Go to full version