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

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

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Ben Pfaff on 9/14/2006 10:19 AM:
> Philipp Marek <philipp@xxxxxxxxxxxxx> writes:
> 
>> On Thursday 14 September 2006 14:49 Eric Blake wrote:
>>> 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 ...
> 
> If you use Gnulib, then umaxtostr will be available everywhere.

Gnulib also provides a portable PRIuMAX, so that you could do this, if you
don't want to commit to providing multiple buffers to umaxtostr:
sprintf("%"PRIuMAX" %s", (uintmax_t) ino, name);

And gettext 0.15 understands PRIuMAX, converting it as needed on various
platforms, if you intend to internationalize your program.

- --
Life is short - so eat dessert first!

Eric Blake             ebb9@xxxxxxx
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFCggi84KuGfSFAYARAumnAJ0cEEVIYckQQwED4475/6fpLGvBbQCgv6qS
F09pOALdKeSaa0YWx9q8CVk=
=wdFV
-----END PGP SIGNATURE-----


_______________________________________________
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