Does anyone know if the above can be used to extract flags from a list of command line arguments? For example, if someone started my app using this command line:-
MyApp -L -D hello goodbye
I could extract the parameters hello and goodbye - but how can I discover that 2 flags preceded them?
"A problem well stated is a problem half solved.” - Charles F. Kettering
Re: CWinAPP::ParseCommandLine() and CCommandLineInfo
Kirants, your code works except for the 'flag' comparisons (/o, /e and /whatever). If the parameter was a flag, Windows strips off the leading '-' or '/'
So, for example, instead of :-
Code:
if (0 == strcmp(pszParam, "/o"))
hozsiew's suggestion would be better :-
Code:
if ((0 == strcmp(pszParam, "o")) && (bFlag))
"A problem well stated is a problem half solved.” - Charles F. Kettering
Bookmarks