kobject sample code

John de la Garza john at jjdev.com
Sat Dec 13 13:01:05 EST 2014


On Tue, Dec 09, 2014 at 10:26:03AM +0100, Paul Bolle wrote:
> On Mon, 2014-12-08 at 21:20 -0500, John de la Garza wrote:
> > I'm looking at samples/kobject/kobject-example.c
> > 
> > at line 39 foo is read:
> > 
> >         sscanf(buf, "%du", &foo);
> > 
> > foo is an int so why is it read using %du not %d?
> 
> My reading of lib/vsprintf.c:vsscanf() is that a "%du" format expects
> "buf" to contain an integer followed by a literal 'u' char. Is that your
> reading too?
> 
After reading the code and the man page for vsscanf, it seems like
it is not expecting the 'u', but rather ignores it.

vsscanf is a bit complicated for me, so I may be missing something.



More information about the Kernelnewbies mailing list