Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

NthArgument() question

May
12,846
164
If I do this,
WCHAR szClassExpr[128] = L"*";
and later while parsing a command line,
else if ( !lstrcmpi(arg, L"/CLASS") )

NthArgument(psz, (++i) | 0x8800, szClassExpr, NULL);
and no argument was provided to the "/CLASS" option, then NthArgument() fails (not finding arg ++i) but szClassExpr gets clobbered (winds up with szClassExpr[0] == 0). This clobbering is mildly inconvenient. Can it be used to advantage? Thanks
 
vefatica wrote:

> If I do this,
>
> WCHAR szClassExpr[128] = L"*";
>
> and later while parsing a command line,
>
> else if ( !lstrcmpi(arg, L"/CLASS") )
>
> NthArgument(psz, (++i) | 0x8800, szClassExpr, NULL);
>
> and no argument was provided to the "/CLASS" option, then NthArgument()
> fails (not finding arg ++i) but szClassExpr gets clobbered (winds up
> with szClassExpr[0] == 0). This clobbering is mildly inconvenient. Can
> it be used to advantage? Thanks

WAD - the target argument is always cleared, regardless of whether
there's a matching argument. This will definitely not be changed, as it
would break most of the internals in TCC & Take Command.

Rex Conn
JP Software
 

Similar threads

Back
Top