You wrote:
>Hi,
>I would like to know how to retrieve the path where the program being
>executed is. Usually it's the current working directory, that you can =
get
>with getcwd, but in some cases that's not true. For example, when the
>program is in the path or when you simply do: folder\program.exe
>Is there any safe way of doing this?
>I could save the name of the directory during installation or something =
like
>that, but actually my program doesn't have any installation, so I would
>prefer another option.
I believe you want something like this:
char directory[255]=3D"";
GetModuleFileName( GetModuleHandle(NULL) ,directory,sizeof(directory));
This will return the exe name and path.
Benedict
|