From: Jonathan S. <js-...@we...> - 2008-12-14 19:38:11
|
Am 14.12.2008 um 20:34 schrieb Keith Marshall: > On Sunday 14 December 2008 16:31:48 Jonathan Schleifer wrote: >> The problem is this line: >> >> if ((size = vsnprintf(NULL, 0, fmt, args)) < 0) >> >> Which always sets size to -1 and thus fails. > > If you don't show us a minimal self-contained, (and complete), test > case, how can you expect us to see what you might be doing wrong? The test case is the asprintf.c which I linked. Try it with any format string, it will always return -1. > $ cat <<EOF > demo.c > #include <stdio.h> > > int main() > { > char *argv[] = { "A string", NULL }; > int l = vsnprintf( NULL, 0, "%s", (void *)(argv) ); > printf( "Required size = %d\n", l ); > return 0; > } > EOF > > $ mingw32-gcc -o demo.exe demo.c > > $ wine demo.exe > Required size = 8 > > works for me, with GCC-3.4.5 and mingwrt-3.15.1. That indeed works. I'll try to find out why yours does while mine doesn't. -- Jonathan |