View previous topic :: View next topic |
Author |
Message |
haxan7
Joined: 27 Jul 2013 Posts: 79
|
[Solved] My Code is Gone |
Posted: Wed Aug 14, 2013 3:30 am |
|
|
Compiler Version 4.140.
I don't know what happened, i pressed ctrl+z, there was an error saying index out of bound or something like that. I pressed pressed ok, my code looked fine so i saved it. But it wasn't ok,Now the bottom 30 lines of code are intact but top 400 lines of code are gone :(
Is there any way i can recover my code?
Does ccs keep code backup somewhere.
Last edited by haxan7 on Wed Aug 14, 2013 3:41 am; edited 1 time in total |
|
|
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Wed Aug 14, 2013 3:34 am |
|
|
The question should be "Do YOU keep a backup somewhere?" Backups are very important, and shouldn't be left to compilers and IDEs to sort out for you.
You may be in luck however. Check for a .bak file in the directory where your source files are. There will be one for each source file that's modified. However, if you've already fiddled about trying to recover your code you may have already unknowingly overwritten it with a copy of your messed up code. |
|
|
haxan7
Joined: 27 Jul 2013 Posts: 79
|
|
Posted: Wed Aug 14, 2013 3:40 am |
|
|
RF_Developer wrote: | The question should be "Do YOU keep a backup somewhere?" Backups are very important, and shouldn't be left to compilers and IDEs to sort out for you.
You may be in luck however. Check for a .bak file in the directory where your source files are. There will be one for each source file that's modified. However, if you've already fiddled about trying to recover your code you may have already overwritten it with a copy of your messed up code. |
I do keep backups but my last backup was a day old.
Thank god for that .bak file, only 15 minutes worth of code gone.
I have got to start taking backups more frequently.
Thanks. |
|
|
alan
Joined: 12 Nov 2012 Posts: 357 Location: South Africa
|
|
Posted: Wed Aug 14, 2013 4:07 am |
|
|
The UNDO function in the IDE are very buggy. I rather use MPLAB's IDE because of that. Not much improvement in Ver5 with the UNDO function. The best is to save before trying an UNDO. That worked for me couple of times.
Regards |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Wed Aug 14, 2013 7:10 am |
|
|
Here's how I do backups...
1) create a directory based on the PIC type( 4550,16f84,etc.)
2) create the original baseline program,usually the 'flashing 1Hz' program, saving it as 'programnameV1.c'
3) create a project using it, saving as projectnameV1.pjt
4) confirm it works...
now...
copy 'old' programnameV1.c to 'new' programnameV2.c
create a new project, projectnameV2,using progrmnameV2.c
make changes to V2..test..save.
repeat as necessay V2,v3,V4,...v101 ! whatever is required.
the 'trick' is to make small changes,save,test that way you can easily go back to a known working program.Nothing is more frustrating than to make 3-4 changes,test, it fails,make a few more changes and really screw things up ! OR the power fails !!!!
Yes, my way takes up a lot of harddrive space but these days that's not a problem. You can always delete all but the last say 3 or 4 versions, once you're sure it's more or less working right.
hth
jay |
|
|
|