Click here to Skip to main content
16,006,348 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to use command line arguments in a win32 application? Pin
Sauce!14-Jul-08 21:36
Sauce!14-Jul-08 21:36 
AnswerRe: How to use command line arguments in a win32 application? Pin
CPallini14-Jul-08 21:41
mveCPallini14-Jul-08 21:41 
GeneralRe: How to use command line arguments in a win32 application? Pin
Sauce!14-Jul-08 21:50
Sauce!14-Jul-08 21:50 
GeneralRe: How to use command line arguments in a win32 application? Pin
CPallini14-Jul-08 22:00
mveCPallini14-Jul-08 22:00 
GeneralRe: How to use command line arguments in a win32 application? Pin
Sauce!14-Jul-08 22:21
Sauce!14-Jul-08 22:21 
GeneralRe: How to use command line arguments in a win32 application? Pin
CPallini14-Jul-08 22:38
mveCPallini14-Jul-08 22:38 
GeneralRe: How to use command line arguments in a win32 application? Pin
Sauce!15-Jul-08 2:39
Sauce!15-Jul-08 2:39 
GeneralRe: How to use command line arguments in a win32 application? Pin
CPallini15-Jul-08 3:15
mveCPallini15-Jul-08 3:15 
Sauce! wrote:
3) I'm not sure what you're getting at here...


Well, suppose:
lpCmdLine = "-w800";


this really means
lpCmdLine[0] = '-';
lpCmdLine[1] = 'w';
lpCmdLine[2] = '8';
lpCmdLine[3] = '0';
lpCmdLine[4] = '0';


Consider lpCmdLine[2] = '8'. Here lpCmdLine[2] is a char variable holding the ASCII value of the character '8' (that is 56 decimal). If you write
int iFirstDigit = lpCmdLine[2];

then you make a mistake, because iFirstDigit will contain 56 instead of 8. On the other hand, writing
int iFirstDigit = lpCmdLine[2] - '0';

you get the expected value (in a rather portable way), since numbers are ordered in the ASCII encoding following their natural (ordinal!) sequence, hence
lpCmdLine[2] - '0' = 56 - 48 = 8.
Now, suppose you make the same for the following digits, obtaining
iFirstDigit = 8; // please note, quite different with respect '8'!
iSecondDigit = 0;
iThirdDigit = 0;

to finally build the number you have to exploint the base 10 positional numbering system, i.e. poorly speaking:
int iNumber = iFrstDigit * 100 + iSecondDigit * 10 + iThirdDigit;

I made the above in a incremental way on previously posted code.
Smile | :)

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke


[My articles]

GeneralRe: How to use command line arguments in a win32 application? Pin
Sauce!15-Jul-08 5:51
Sauce!15-Jul-08 5:51 
GeneralRe: How to use command line arguments in a win32 application? Pin
CPallini16-Jul-08 7:04
mveCPallini16-Jul-08 7:04 
AnswerRe: How to use command line arguments in a win32 application? Pin
David Crow15-Jul-08 3:21
David Crow15-Jul-08 3:21 
QuestionHow to verify that calling process has read access to the specified range of memory in vista Pin
V K 214-Jul-08 20:33
V K 214-Jul-08 20:33 
AnswerRe: How to verify that calling process has read access to the specified range of memory in vista PinPopular
Stephen Hewitt14-Jul-08 20:42
Stephen Hewitt14-Jul-08 20:42 
AnswerRe: How to verify that calling process has read access to the specified range of memory in vista Pin
Stephen Hewitt14-Jul-08 20:53
Stephen Hewitt14-Jul-08 20:53 
Questionfatal error: Cannot open type library file: 'msxml.dll' in Vista Pin
NiceNaidu14-Jul-08 19:48
NiceNaidu14-Jul-08 19:48 
AnswerRe: fatal error: Cannot open type library file: 'msxml.dll' in Vista Pin
Stephen Hewitt14-Jul-08 20:22
Stephen Hewitt14-Jul-08 20:22 
Questionenable DHCP using win32 API Pin
an8914-Jul-08 19:45
an8914-Jul-08 19:45 
AnswerRe: enable DHCP using win32 API Pin
Stephen Hewitt14-Jul-08 20:36
Stephen Hewitt14-Jul-08 20:36 
Question[Window Mobile Owner Draw] Pin
jjobluewind9714-Jul-08 19:39
jjobluewind9714-Jul-08 19:39 
Questionerror C2143: syntax error : missing '{' before ':' Pin
rp_suman14-Jul-08 18:11
rp_suman14-Jul-08 18:11 
AnswerRe: error C2143: syntax error : missing '{' before ':' Pin
ThatsAlok15-Jul-08 3:36
ThatsAlok15-Jul-08 3:36 
GeneralRe: error C2143: syntax error : missing '{' before ':' Pin
rp_suman15-Jul-08 4:18
rp_suman15-Jul-08 4:18 
QuestionRe: error C2143: syntax error : missing '{' before ':' Pin
rp_suman15-Jul-08 18:22
rp_suman15-Jul-08 18:22 
Questionerror C2061: syntax error : identifier 'BOOL' Pin
rp_suman14-Jul-08 17:39
rp_suman14-Jul-08 17:39 
AnswerRe: error C2061: syntax error : identifier 'BOOL' Pin
rp_suman14-Jul-08 18:12
rp_suman14-Jul-08 18:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.