[DGD] Use of sscanf

Jay Shaffstall jshaffst at netwalk.com
Wed May 7 17:54:29 CEST 2003


>What it actually does is scan the integer part of the string, up to but
>not including the "." which does not figure in integers.  You mistakenly
>assumed that sscanf would match the entire string, when it could just
>match the first two characters.

Since my format string contains only a "%d", I did rather assume the entire 
string would be matched, since if what I really wanted was just the integer 
portion I could do "%d.%*s".  From the kfun docs on sscanf, it wasn't 
obvious that I could have a format string that matched only a portion of a 
string, so I've been writing all of my sscanfs assuming I needed to match 
the entire string.  I'll have to go back and make sure there aren't any 
other odd cases like this one in the rest of them.

Thanks for the info,
Jay


_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list