I was wondering how do you fin the current directory that your program is running from? I know in a console app you can get that out of argv[], i looked at the command line info that WinMain passes in lpCmdLine and it was blank.
Printable View
I was wondering how do you fin the current directory that your program is running from? I know in a console app you can get that out of argv[], i looked at the command line info that WinMain passes in lpCmdLine and it was blank.
Look into GetCurrentDirectory().
Try:
char * args = GetCommandLine();
Unfortunately, Windows forces you to parse it yourself (typical :mad: )!
Also, there's the good ole getcwd():
Code:
char buff[100];
char dir[100];
getcwd(buff, 100);
sprintf(dir, "Currently in %s", buff);
MessageBox(NULL, dir, "Directory:", MB_OK);
Ok thanks but i had just found _getcwd(char*, int); Is that just visual C specific?
It should work fine. BTW, GetCurrentDirectory() works identically, but with reversed parameters.