2010-11-05 22:21:36 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: GNU GPL, see COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS crt library
|
|
|
|
* FILE: lib/sdk/crt/printf/_snprintf.c
|
|
|
|
* PURPOSE: Implementation of _snprintf
|
|
|
|
* PROGRAMMER: Timo Kreuzer
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <tchar.h>
|
|
|
|
|
|
|
|
int _cdecl streamout(FILE *stream, const char *format, va_list argptr);
|
|
|
|
|
|
|
|
int
|
|
|
|
_cdecl
|
|
|
|
_snprintf(char *buffer, size_t count, const char *format, ...)
|
|
|
|
{
|
|
|
|
va_list argptr;
|
|
|
|
int result;
|
|
|
|
FILE stream;
|
|
|
|
|
|
|
|
stream._base = buffer;
|
|
|
|
stream._ptr = stream._base;
|
|
|
|
stream._charbuf = 0;
|
2011-01-01 13:50:07 +00:00
|
|
|
stream._bufsiz = count;
|
2010-11-05 22:21:36 +00:00
|
|
|
stream._cnt = stream._bufsiz;
|
|
|
|
stream._flag = 0;
|
|
|
|
stream._tmpfname = 0;
|
|
|
|
|
|
|
|
va_start(argptr, format);
|
|
|
|
result = streamout(&stream, format, argptr);
|
|
|
|
va_end(argptr);
|
2011-01-01 13:50:07 +00:00
|
|
|
|
2010-11-05 22:21:36 +00:00
|
|
|
*stream._ptr = '\0';
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|