Re: Funny (NOT!) piece of C strangeness.
Posted: Sun Sep 20, 2009 6:09 am
Ha, victory is mine!
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.
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
*/