Boost logo

Boost :

From: Caleb Epstein (caleb.epstein_at_[hidden])
Date: 2004-10-25 07:44:55


On Sat, 23 Oct 2004 07:10:48 +0000 (UTC), Darryl Green
<darryl.green_at_[hidden]> wrote:

> char buf[101];
> va_list args;
> va_start(args, fmt);
> int n = vsnprintf (buf, 101, fmt, args));
> va_end(args);
> if (n < 0) return;

This is one of the reasons I find the *snprintf functions to be pure
evil. They don't return -1 when the output would be too long, they
return the size they WOULD have written if the buffer was large
enough.

Is this code doing what you intend?

-- 
Caleb Epstein
caleb.epstein_at_[hidden]

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk