tcharize a couple of routines
[reactos.git] / reactos / lib / crt / stdio / fprintf.c
1 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
2 #include <stdio.h>
3 #include <wchar.h>
4 #include <tchar.h>
5 #include <internal/file.h>
6
7 /*
8 * @implemented
9 */
10 int
11 _ftprintf(register FILE *iop, const _TCHAR *fmt, ...)
12 {
13 int len;
14 _TCHAR localbuf[BUFSIZ];
15 va_list a=0;
16
17
18 va_start( a, fmt );
19 if (iop->_flag & _IONBF)
20 {
21 iop->_flag &= ~_IONBF;
22 iop->_ptr = iop->_base = (char *)localbuf;
23 iop->_bufsiz = BUFSIZ;
24 len = _vftprintf(iop,fmt,a);
25 fflush(iop);
26 iop->_flag |= _IONBF;
27 iop->_base = NULL;
28 iop->_bufsiz = 0;
29 iop->_cnt = 0;
30 }
31 else
32 len = _vftprintf(iop, fmt, a);
33 return ferror(iop) ? -1 : len;
34 }