How to recover an Arduino sketch from after a program crash or system crash.I was working on some code today then after making a heap of code changes and uploading to boards I walked away from my computer without saving my Sketch.
Due to some other things I was doing at the time Windows crashed and I had not saved my code yet. After a reboot I confirmed that my code was gone but I did not like the idea of that so went digging for it. I know the Hex file is compiled to the %temp% folder so the Sketch must be there too.
which took me to C:\Users\remote\AppData\Local\Temp\
Then I sorted the folders by date modified and then found this one was timestamped about the same time I last compiled my code.
Opening the folder I see a few C++ files and one of them had the same name as my sketch but with a C++ extension. It was my Aduino Sketch it did have a few things added to it to make it C++ compatible (void's) but is was the code I thought I had lost.