New ReactOS icon by Mindflyer. Just give ros a fresh look :)
[reactos.git] / reactos / lib / crt / stdio / vsprintf.c
1 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
2 #include <stdio.h>
3 #include <stdarg.h>
4 #include <limits.h>
5 #include <internal/file.h>
6 #include <tchar.h>
7
8 /*
9 * @implemented
10 */
11 int
12 _vstprintf(_TCHAR *str, const _TCHAR *fmt, va_list ap)
13 {
14 FILE f = {0};
15 int len;
16
17 f._flag = _IOWRT|_IOSTRG|_IOBINARY;
18 f._ptr = (char*)str;
19 f._cnt = INT_MAX;
20 f._file = -1;
21 len = _vftprintf(&f,fmt, ap);
22 *(_TCHAR*)f._ptr = 0;
23 return len;
24 }
25
26
27 /*
28 * @implemented
29 */
30 int
31 _vsntprintf(_TCHAR *str, size_t maxlen, const _TCHAR *fmt, va_list ap)
32 {
33 FILE f = {0};
34 int len;
35
36 f._flag = _IOWRT|_IOSTRG|_IOBINARY;
37 f._ptr = (char*)str;
38 f._cnt = maxlen;
39 f._file = -1;
40 len = _vftprintf(&f,fmt, ap);
41 // what if the buffer is full ??
42 *(_TCHAR *)f._ptr = 0;
43 return len;
44 }