--- Jean le Roux <jean@...> wrote: > Hi all
> I notice that stdio.h does not declare an snprintf() function
> under mingw. It does however provide all the other "expected" tools
> such as:
> int printf(const char *format, ...);
> int fprintf(FILE *stream, const char *format, ...);
> int sprintf(char *str, const char *format, ...);
> //not present under mingw: int snprintf(char *str, size_t size, const
> char *format, ...);
> There is however an _snprintf() declared. From what I can tell
> it's interchangeable with the normal snprintf().
> It looks like:
> int _snprintf(char *str, size_t size, const char *format, ...);
> How do you guys go about catering for snprintf calls? Would a macro
> in the source file suffice ?
> #ifdef __MINGW32__
> #define snprintf _snprintf
That will work as a local fix, but I am hesitant to put that in stdio.h
header just yet.
Until C99, snprintf was not part of standard. I am actually working on
putting all the _foo functions from msvcrt.dll that are not oldnames but
are C99 names into headers and also (as stub functions) into libs. One
reason for putting them into lib, is that many configure scripts do two
tests: One to check for declaration, another (providing a minimal
declaration in source and not including header) to check if function is in
In C++, defines like that can cause problems with namespaces (eg,
::snprintf), and G+ headers actually undefine C runtime function macro
http://www.sold.com.au - SOLD.com.au Auctions
- 1,000s of Bargains!