1 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
3 #include <crtdll/stdio.h>
4 #include <crtdll/wchar.h>
5 #include <crtdll/errno.h>
6 #include <crtdll/internal/file.h>
11 int putc(int c, FILE *fp)
14 // valid stream macro should check that fp
16 if (!__validfp (fp)) {
20 // check for write access on fp
22 if ( !OPEN4WRITING(fp) ) {
27 fp->_flag |= _IODIRTY;
30 *(fp)->_ptr++ = (unsigned char)c;
31 return (int)(unsigned char)c;
34 return _flsbuf((unsigned char)c,fp);
39 wint_t putwc(wchar_t c, FILE *fp)
41 // might check on multi bytes if text mode
44 fp->_cnt-= sizeof(wchar_t);
45 *((wchar_t *)(fp->_ptr))++ = c;
49 return _flswbuf(c,fp);