[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question regarding sscanf() vs. off_t and similar
From: |
Eric Blake |
Subject: |
Re: Question regarding sscanf() vs. off_t and similar |
Date: |
Thu, 14 Sep 2006 06:49:48 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060719 Thunderbird/1.5.0.5 Mnenhy/0.7.4.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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);
- --
Life is short - so eat dessert first!
Eric Blake address@hidden
-----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
iD8DBQFFCU/s84KuGfSFAYARAuuQAJsHZq22FdhHbfrOtsL1/rWx0ihelQCeIDre
hXNjTDgGGkMyCbYjXR1b4a8=
=6u8G
-----END PGP SIGNATURE-----
Re: Question regarding sscanf() vs. off_t and similar, Andreas Schwab, 2006/09/14