Can a executable find the path to itself?
Iím writing a short executable that will be run by both clicking on it and being called from another program (IDL). Is there a function that I can put in this executable that returns the path to itself? Since, ďmyprogram.exeĒ might be moved to a different location I donít want to hard wire the path, but I want an outputted text file to end up in the same location as the executable. Iíve tried _fullpath, which returns the correct path if you double click on it, but returns the incorrect path if called from IDL.
Double click on myprogram.exe -> C:\myprogram\ myprogram.exe :D
sprintf(szBuffer,_fullpath( NULL, "myprogram.exe", _MAX_PATH ));
Call from IDL -> C:\Location_of_IDL_File\myprogram.exe :(
Any ideas, thanks,