snprintf return value

Rob Kendrick rjek at
Fri Oct 18 14:24:58 PDT 2002

On Fri, Oct 18, 2002 at 09:50:24PM +0200, John Tytgat wrote:
> In message <3DAFC8E4.3070804 at>
>           Alex Waugh <Alex.Waugh at> wrote:
> > snprintf sometimes returns EOF when the buffer is not large enough; it
> > should return the number of characters that would be written had the
> > buffer been big enough. The following patch fixes this.
> Spot the man who wants his code to be ISO99 compliant... ;-)

Bah.  *Real* men have an open file descriptor to /dev/null and printf
there first to see how many bytes to allocate. ;-)

Rob Kendrick                             
PGP signed or encrypted mail welcome                         Key ID: 3651D17A

More information about the gcc mailing list