Author Topic: CodeBlocks Crashed and Deleted The Contents of My File? (windows 8)  (Read 9048 times)

furrare

  • Guest
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.]
« Last Edit: October 25, 2015, 09:26:28 am by MortenMacFly »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: CodeBlocks Crashed and Deleted The Contents of My File? (windows 8)
« Reply #1 on: October 24, 2015, 10:33:08 am »
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?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3352
Re: CodeBlocks Crashed and Deleted The Contents of My File? (windows 8)
« Reply #2 on: October 24, 2015, 11:51:09 pm »
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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: CodeBlocks Crashed and Deleted The Contents of My File? (windows 8)
« Reply #3 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: CodeBlocks Crashed and Deleted The Contents of My File? (windows 8)
« Reply #4 on: October 26, 2015, 07:46:14 pm »
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.
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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline raynebc

  • Almost regular
  • **
  • Posts: 223
Re: CodeBlocks Crashed and Deleted The Contents of My File? (windows 8)
« Reply #5 on: October 26, 2015, 11:03:47 pm »
Modern versions of Windows will explicitly give an access denied error if you try to write to a User Account Control protected location from any process not running with administrator privileges.  I have never seen it instead delete a file that a process attempted to write to but didn't have access to in this manner.  Maybe that would be more likely to be anti-virus behavior instead.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3352
Re: CodeBlocks Crashed and Deleted The Contents of My File? (windows 8)
« Reply #6 on: October 30, 2015, 01:04:38 am »
So this is the second data corruption on Windows 8 in this forum. Where do you have stored your code? on the desktop? Have you an anti virus scanner activated? Is there a *.temp file in your project folder?

greetings