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