User forums > Help
My entire C file cleared and lost by CB
@nthony:
Please help me, C::B has just crashed and with it, ate my ENTIRE project's C file (over 4000 lines of code). This represents MONTHS of work for me (my last back up was a while ago) and I am completely lost as to what I can do now.
It crashed while I was switching tabs between files within the editor, the file I was switching from was unscathed, but the file I was switching to was completely emptied. I need to know if there is ANY place that C::B maintains its own back-ups or history copies of files it has opened, or for that matter even Windows?
I've just lost it right now, and I won't shutdown my computer until I've exhausted every resource, so please if anyone knows any way I can retrieve the last saved copy please let me know. My mind is blown right now, days and hours of work have been lost...
I've been going over what just happened in my mind as its spinning and I just cant understand for the life of me WHY it would choose to eat my file... even though code:blocks rarely crashes, it could be unfortunate if you have forgotten to save, but why in god's name would it maliciously EAT everything you've already had before the save point... I just dont get it, it almost seems deliberately evil. I managed to find a recently created file named codeblocks.rpt after the crash, I hope this can shed some light on where my file might be (and I hope to god it still exists).
[attachment deleted by admin]
thomas:
If you have the autosave plugin installed, you should have a recent backup created automatically. By default, if you have not changed the settings, that will be a file with the same name as your original source, and .save appended.
Other than that, Code::Blocks never saves anything or writes to any files (other than its config file) unless you explicitely tell it to do so.
Saving files is done atomically using temporary files and switching file pointers after completion, so if anything crashes while saving, the original file will always be either 100% ok, or 100% untouched, or found in the temp folder (under a random name).
You may want to check if your files are really empty. It is quite possible that your sources are still there, and you only have the encoding messing up for some reason (look at file info in Explorer, if the file size is not 0, then it is not empty!).
@nthony:
File size/contents is completely 0 in explorer. I don't even have the heart to re-open it one more time, its just killing me right now.
I will continue checking for a .save file, but I do not believe auto save was on (as I often save my own work frequently), and nothing has turned up yet.
Even in the application I was creating in CB, writing to a user file only occured after writing to a temp file completed succesfully. I did this explicitly to prevent eating the user's file in case of a crash during writing.
I am not so certain CB does the same on all occasions, for it makes no sense as to why a 4000+ line C file would magically be emptied of its contents, even on a crash. I've experienced the odd crash on CB and, at most, have lost the last couple of lines I wrote before saving, but never has it emptied my source file. I've been trying to avoid thinking about this ordeal, but everytime I do it's as to "why? how could this happen?", and I can only come up with one logicial explanation: Somewhere, somehow, someone has carelessly fopen'd the original file with write access, hoping that the transaction would complete normally, but in this case it crashed shortly after opening it, but promptly before the contents could be written. In an even more malicous twist, this whole process occured inbetween rebuilding the project, so as if to taunt me even more, CB has deleted my last working binary file and object file, so there's not even a chance for a "final", or an attempt at reverse engineering it.
Maybe there's a more complex, better explanation, but as for now, I'm more concerned about retreiving my file. What about Window's facilities, such as system restore, etc? might it have saved a back-up somewhere?
MortenMacFly:
--- Quote from: @nthony on August 28, 2007, 03:24:40 am ---What about Window's facilities, such as system restore, etc? might it have saved a back-up somewhere?
--- End quote ---
You might try undelete tools for NTFS, but they are usually not free. (I'm not sure if this one is, maybe: http://ntfsundelete.com/). Keep in mind that installing a new software might overwrite the part in the partition with the data that got lost. So at least install in another partition. This also applies to any application that creates temp-files for example. There might also be a *.cbTemp file around or in your either application data or my files folder might be a new folder called cb_[any_number] with data saved from the crash.
With regards, Morten.
@nthony:
Unfortunately, the file hasn't just been deleted, but CB has written all zeroes to it, which I think is the bane of most undelete utilities.. but in desperation, its worth a try. Since the incident, there have been a number of other (temp) files created by other programs as well, so the prospects don't look good. I've searched for any and everything modified and/or created during the time of the crash, and nothing helpful has surfaced (just the file itself, and some .layout, .depend, etc CB files, no saved data). So I guess that's that... after something like this happens, you just don't even have the heart to start over again...
Navigation
[0] Message Index
[#] Next page
Go to full version