any quick way of getting the path to the app, i know there is getmodulefilename but anything else?
any quick way of getting the path to the app, i know there is getmodulefilename but anything else?
What makes you think the way you have is particularly slow?
Is it too difficult to type in or something?
Just how many times are you planning on calling it anyway?
got it sussed,
Code:char Directory[MAX_PATH] = ""; GetModuleFileName(NULL, Directory, MAX_PATH);
ultra newb question here:-
how do you join 2 chars together like,
"C:\" and "myapp.exe" to obviously give,
"C:\myapp.exe"
?
strcat
thanks.Originally Posted by Salem
it looks like i need to copy both chars into a buffer to join them like this,
why can't i just say,Code:char * stuff = "abc"; char * morestuff = "efg"; char str[80]; strcpy (str,stuff); strcat (str,morestuff); MessageBox(NULL,str ,"",0);
Code:char * stuff = "asd"; char * morestuff = "dfg"; MessageBox(NULL,strcat(stuff,morestuff) ,"",0);
Because strcat() needs to store the result somewhere, and that somewhere is the memory pointed to by the first parameter.
Since "strings like this" are constant, any attempt to modify them usually fails, either because the OS makes them read-only, or because there isn't any room to append more data.