Re: Question regarding sscanf() vs. off_t and similar

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 14 September 2006 14:49 Eric Blake wrote:
> According to Philipp Marek on 9/13/2006 1:05 PM:
> > If I'm doing
> > 	ino_t ino;
> > 	char *name;
> > 	sprintf("%Lu %s", ino, name);
> > that works fine for 64bit systems, but writes trash for sizeof(ino_t) ==
> > 4.
>
> Gnulib provides umaxtostr.c, which is a convenient way of printing any
> integer of unknown width:
>
> char buf[INT_BUFSIZE_BOUND (uintmax_t)];
> sprintf("%s %s", umaxtostr(ino, buf), name);
But then I'd need a few of these buffers in a sprintf() call with 15 
arguments, and if umaxtostr() is not available on solaris etc. I can't use 
it ...

But that's an idea - writing my own umaxtostr() function. Maybe that's an 
idea.

Or I cast everything to an (long long) type ... then it should work, too.


Thank you for this answer!


Regards,

Phil

-- 
Versioning your /etc, /home or even your whole installation?
             Try fsvs (fsvs.tigris.org)!


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux