Hi, I am using GetModuleFileName(NULL, application_path, length) in order to get the application directory but it returns the entire path, including the name of the executable. What I want is only the directory where the current executable is located. Is there any other way, I am doing something wrong? Thanks!
::GetModuleFileName(0, szAppPath, sizeof(szAppPath));
::std::cout << "the full path is :" << szAppPath;
// use strrchr to set the executable ''
char * pc =strrchr(szAppPath,"\\");
if (pc) {
*pc = '\0';
}
::std::cout << "the needed path is :" << szAppPath;
Even better, modoran. That's one I didn't know about. I've found myself more and more frequently using functions from shlwapi.h/.dll. I guess I ought to actually open up the .h file and take a look at what all is in it.