Explain this sscanf behavior.

Bradford R. Daniels daniels at tle.enet.dec.com
Sat Jul 14 01:45:07 AEST 1990


> >> compiler B:

> >> 	x=1   a=123  b=3
> >> 	x=1   a=123  b=4  <-- yes 4.
> 
> >This is clearly wrong, since there aren't even 4 characters in the string...
> 
>  Why, the value of b is clearly invalid as only one
>  argument was comsumed. Nothing was read into b so
>  how can you say it was incorrectly assigned.

Pardon?  I have to disagree with you here.  Clearly, an assignment was made,
otherwise the value of b would be -99.  The return value of 1 tells us nothing,
since the standard explicitly states that the count of converted arguments
does not get incremented by %n.

- Brad

-----------------------------------------------------------------
Brad Daniels			|  Digital Equipment Corp. almost
DEC Software Devo		|  definitely wouldn't approve of
"VAX C RTL Whipping Boy"	|  anything I say here...



More information about the Comp.std.c mailing list