0ad/source/lib/secure_crt.cpp
janwas 78d950e419 Add some missing file comments in source/lib.
win_internal -> win.h (pulls in <windows.h>, with fixes afterwards)
remove empty waio_internal and wsysdep
Move source/sound license notice into source/sound/license.txt

This was SVN commit r5044.
2007-05-08 15:11:53 +00:00

40 lines
878 B
C++

/**
* =========================================================================
* File : secure_crt.cpp
* Project : 0 A.D.
* Description : partial implementation of VC8's secure CRT functions
* =========================================================================
*/
// license: GPL; see lib/license.txt
#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