[CMAKE]
[reactos.git] / lib / sdk / crt / printf / _vsnprintf.c
1 /*
2 * COPYRIGHT: GNU GPL, see COPYING in the top level directory
3 * PROJECT: ReactOS crt library
4 * FILE: lib/sdk/crt/printf/_vsnprintf.c
5 * PURPOSE: Implementation of _vsnprintf
6 * PROGRAMMER: Timo Kreuzer
7 */
8
9 #include <stdio.h>
10 #include <stdarg.h>
11
12 int _cdecl streamout(FILE *stream, const char *format, va_list argptr);
13
14 int
15 __cdecl
16 _vsnprintf(
17 char *buffer,
18 size_t count,
19 const char *format,
20 va_list argptr)
21 {
22 int result;
23 FILE stream;
24
25 stream._base = buffer;
26 stream._ptr = stream._base;
27 stream._bufsiz = count;
28 stream._cnt = stream._bufsiz;
29 stream._flag = _IOSTRG | _IOWRT;
30 stream._tmpfname = 0;
31 stream._charbuf = 0;
32
33 result = streamout(&stream, format, argptr);
34 *stream._ptr = '\0';
35
36 return result;
37 }