download lost program

I made a goofy "new guy" mistake. I got busy writing a program and had a fair amount of work put into it and didn't save the sketch. I did have it uploaded onto my Arduino Mega and it is still there running. How can I download that sketch from the board to my computer? I thought maybe the EEPROM read would do that but I get the error

In file included from C:\Users\Brad Dickerson\Desktop\New Folder (3)\Arduino\arduino-0021\libraries\EEPROM\EEPROM.cpp:24:
c:/users/brad dickerson/desktop/new folder (3)/arduino/arduino-0021/hardware/tools/avr/lib/gcc/../../avr/include/avr/eeprom.h: In function 'void eeprom_read_block(void*, const void*, size_t)':
c:/users/brad dickerson/desktop/new folder (3)/arduino/arduino-0021/hardware/tools/avr/lib/gcc/../../avr/include/avr/eeprom.h:290: error: ISO C++ forbids incrementing a pointer of type 'void*'

etc...

Which I have no idea what it means
I really don't want to start over it possible.
please help

What gets downloaded into the arduino is the compiled HEX output file that the uC runs - if you read it back, it is not something you can edit anymore to make changes to.
You need to get in the habit of pressing Save before you compile & download.

Exactly what CrossRoads said: you're going to need to start over.

(A hobby of mine involves reverse-engineering embedded code in certain vehicle engine control units. Yes, technically, the code that you wrote is still there, but it's not going to look like anything you'll want to modify, unless assembly is something you find exciting. You'll actually have better luck trying to recover/"undelete" the relevant file.)

Look on the bright side, it's good practice to trash version 1 (and even version 2) and rewrite as you do a lot better next time around.

While I've never done this deliberately I did lose a few weeks of work on a project once, but the rewrite was MUCH better code.

Oh, and get used to using ^S and frequent backups :slight_smile:


Rob

Well that's thoroughly crap! It wasn't too bad. I salvaged a piece of the code from another file but I still have to rewrite the rest.

I appreciate the help and the quick response.

Thanks guys. :slight_smile:

There is a chance that in the temp directory there is a copy of the .pde file except its extension is .cpp

Such a directory looks like - C:\Users\Rob\AppData\Local\Temp\build2750385992883239260.tmp - on a windows platform. As said the source file is renamed to .cpp and some headers are added but most of the code could be there.

hopes this helps,

Rob