Funny (NOT!) piece of C strangeness.

Programming, for all ages and all languages.
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: Funny (NOT!) piece of C strangeness.

Post by Kevin »

Ha, victory is mine! ;)

Code: Select all

/* tyndur libc

sscanf:  Returned 0, result -1, consumed -1
fscanf:  Returned 0, result -1, consumed -1, next z
strtoul:             result  0, consumed 2

sscanf:  Returned 0, result -1, consumed -1
fscanf:  Returned 0, result -1, consumed -1, next z
strtoul:             result  0, consumed 2
*/
This is the result of the scanf implementation I did a few days ago. "next z" is the result of an additional fgetc after fscanf. I think these results match exactly what you describe.
Developer of tyndur - community OS of Lowlevel (German)
Post Reply