NthArgument() question

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
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
 

rconn

Administrator
Staff member
May 14, 2008
10,101
85
#2
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