1 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
3 #include <msvcrt/stdio.h>
4 #include <msvcrt/wchar.h>
5 #include <msvcrt/errno.h>
6 #include <msvcrt/internal/file.h>
12 int putc(int c
, FILE* fp
)
14 // valid stream macro should check that fp is dword aligned
15 if (!__validfp (fp
)) {
19 // check for write access on fp
21 if ( !OPEN4WRITING(fp
) ) {
26 fp
->_flag
|= _IODIRTY
;
29 *(fp
)->_ptr
++ = (unsigned char)c
;
30 return (int)(unsigned char)c
;
33 return _flsbuf((unsigned char)c
,fp
);
38 //wint_t putwc(wint_t c, FILE* fp)
39 //int putwc(wchar_t c, FILE* fp)
40 int putwc(wint_t c
, FILE* fp
)
42 // might check on multi bytes if text mode
45 fp
->_cnt
-= sizeof(wchar_t);
46 *((wchar_t *)(fp
->_ptr
))++ = c
;
50 return _flswbuf(c
,fp
);