Executable path
I need to find the path of where my program is running. Using argv[0] doesn't seem to work bec开发者_如何学Goause the program has to be run on the windows console, for example, C:\ >player parameter1 parameter2 and I only get player on argv[0].
How can I accomplish this?
You can use Windows' GetModuleFileName function to obtain the path of the executable by setting the hModule parameter to NULL.
Not sure exactly what you mean by "path of where my program is running" ... if you mean the current working directory, getcwd in c/c++ would get you what you want.
EDIT:
As was also mentioned, GetModuleFileName will retrieve the actual EXE name ... see here for similar question posted on another Q&A site.
加载中,请稍侯......
精彩评论