How to get the Path my Exe is working in?
Hi there,
I want to copy a file from my Exe''s path to somewhere the users wants it to be. But how do i get the path of my Exe?
Thanks
char path_name[1000];GetModuleFileName(GetModuleHandle(NULL),path_name,1000);
Now "path_name" contains the path of the program that ran it.
I often use "_getcwd" (standard C) and it seems to work. By the way, isn't this information already in argv[0]? - I'll have to check about this last one.
EDIT: of curse, you have to call it *before* changing direcories since _getcwd returns the current one... Which should be app directory if you don't mess up before calling.
[edited by - Krohm on July 22, 2003 3:59:53 AM]
EDIT: of curse, you have to call it *before* changing direcories since _getcwd returns the current one... Which should be app directory if you don't mess up before calling.
[edited by - Krohm on July 22, 2003 3:59:53 AM]
Previously "Krohm"
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement