Visual C++ does not seem to have snprinft
David Laight
david at l8s.co.uk
Fri Sep 8 12:11:13 CDT 2006
On Fri, Sep 08, 2006 at 12:05:29AM +1000, Jeff L wrote:
>
> #define snprintf _snprintf
Unfortunately the above isn't adequate, the windows _snprintf() isn't
the same beast as the posix (or is it even part of C now?) snprintf()
in particular:
1) _snprintf() returns -1 if the data wouldn't fit (not the number of bytes
that would have been output).
2) _snprintf() doesn't always NUL terminate the output! In particular
_snprintf(buf, 2, "ab" ) will set buf[0] = 'a', buf[1] = 'b', and
return 2.
Almost certainly not what the calling code expceted.
David
--
David Laight: david at l8s.co.uk
More information about the wine-devel
mailing list