Jun 11, 2003 #1 scienzia Programmer Feb 21, 2002 160 IT Hi, I would like to know how to take parameters from command line running. I mean I want to be able to run my application by DOS like this: > MyApp -x -a and get the parameters inside the application. Thanks in advance.
Hi, I would like to know how to take parameters from command line running. I mean I want to be able to run my application by DOS like this: > MyApp -x -a and get the parameters inside the application. Thanks in advance.
Jun 11, 2003 #2 Wiggis Programmer Jun 9, 2003 10 GB the int main(int argc, char* argv[]) method stores all command line arguments in the argv[] array you can then access them the same way you would normally access members of an array, just make sure the parameter exists before you try and access it Upvote 0 Downvote
the int main(int argc, char* argv[]) method stores all command line arguments in the argv[] array you can then access them the same way you would normally access members of an array, just make sure the parameter exists before you try and access it
Jun 13, 2003 Thread starter #3 scienzia Programmer Feb 21, 2002 160 IT I'm sorry my post missed some informations... I'm talking abount MFC, and I didn't find anything similar to Code: int main(int argc, char* argv[]) [\code] Upvote 0 Downvote
I'm sorry my post missed some informations... I'm talking abount MFC, and I didn't find anything similar to Code: int main(int argc, char* argv[]) [\code]
Jun 13, 2003 #4 CMR Programmer Apr 30, 2002 76 AU Check out the CCommandLineInfo class. You can create a new class that inherits from this and add specific command line handlers by overriding the "ParseParam()" member function. CMR Upvote 0 Downvote
Check out the CCommandLineInfo class. You can create a new class that inherits from this and add specific command line handlers by overriding the "ParseParam()" member function. CMR
Jun 13, 2003 #5 BEHZADTALA Programmer May 28, 2003 43 DE Hi, you can use ::GetCommandLine() function and then if you want you can convert the LPSTR result to argv and argc with the CommandLineToArgvW() brgd Upvote 0 Downvote
Hi, you can use ::GetCommandLine() function and then if you want you can convert the LPSTR result to argv and argc with the CommandLineToArgvW() brgd