tf68
Thanks for that. It would be interesting to find what range of file paths people get. Both my Win XP and Win 7 give the full file path.
Just to show how grey my beard really is, all my real time programming was in CORAL 66 and I was on the BSI committee which standardised it (BS 5905:1980). Since then I have used Pascal and Delphi, but only a tiny bit of C.
The problem I have with Arduino is not knowing which bits are C, C++ and just straight Arduino - and that is before you have to work around the bugs. For example it took me ages to work out samples of code which used streaming - a bit of commenting would have helped, but to the uninitiated it had me really confused - it was the << bits that really bugged me! But now I find it SO useful.
However - Google to the rescue...
http://stackoverflow.com/questions/8487986/file-macro-shows-full-path
has the solution...
#include <string.h>
#define FILENAME (strrchr(FILE, '/') ? strrchr(FILE, '/') + 1 : FILE)
For Windows use '\' instead of '/'.
- and that works a treat!
- just the filename comes out now