App.Path in c++

orufet
01-25-2002, 08:03 AM
Ok, I know there is something like this, but whether or not I can understand it might be a problem. I'm looking for a function that will return the path of the exe file. Thanks

reboot
01-25-2002, 08:12 AM
Here's one way. Someone else might have a shorter solution....

// find the working directory

int len;

char szAppPath[256];
char szFileTitle[256];

memset(szAppPath, 0, sizeof(szAppPath));
memset(szFileTitle, 0, sizeof(szFileTitle));
GetModuleFileName(hInst, szAppPath, sizeof(szAppPath));
GetFileTitle(szAppPath, szFileTitle, sizeof(szFileTitle));
len = lstrlen(szAppPath) - lstrlen(szFileTitle);
szAppPath[len] = '\0';

orufet
01-25-2002, 08:13 AM
Thanks! Don't have time to test it now (school), but I'll use it later. Again, thanks

rodfiuza
01-29-2002, 03:47 AM
Just one question: which header file should we include to get this functions ?

reboot
01-29-2002, 08:01 AM
windows.h

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum