1
1
forked from 0ad/0ad
0ad/source/lib/secure_crt.cpp
Ykkrosh ec69bccb2c # Tidied up some code.
- Made some classes not be singletons, since there's no reason why they
should be.
 - Made them non-global too (because globals have unclear lifetimes, and
make it harder to test things, etc). They're now owned by CGameView and
CWorld, and mostly accessed via g_Game or arguments (vaguely trying to
avoid the graphics code calling into the game code).
 - Moved CGameView implementation into pimpl, so the header file isn't
so heavy.
 - Changed a few pointers into references, to indicate that they're
never NULL.

This was SVN commit r4756.
2007-01-08 01:56:46 +00:00

31 lines
541 B
C++

#include "precompiled.h"
#include <stdio.h>
#include <errno.h>
#include "secure_crt.h"
#if !HAVE_SECURE_CRT
int sprintf_s(char* buf, size_t max_chars, const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
int len = vsnprintf(buf, max_chars, fmt, args);
va_end(args);
return len;
}
errno_t fopen_s(FILE** pfile, const char* filename, const char* mode)
{
*pfile = NULL;
FILE* file = fopen(filename, mode);
if(!file)
return ENOENT;
*pfile = file;
return 0;
}
#endif // #if !HAVE_SECURE_CRT