www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++.windows.32-bits - snprintf

should snprintf be wrapped in vsnprintf? this was the only way I could get my
small program to link.  Without the wrapper I would get this:

Error 42: Symbol Undefined _snprintf



#include <stdio.h>
#include <stdarg.h>

int
snprintf (char *str, int n, char *fmt, ...)
{
va_list a;
va_start (a, fmt);
int ret = vsnprintf (str, n, fmt, a);
va_end (a);
return ret;
}


int
main (void)
{
char b[1024];
int i = snprintf (b, sizeof (b), "%1.1f", 6442452944.1234);
return 0;
}
Dec 31 2004