3 /* fputc( int, FILE * )
5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
13 /* Write the value c (cast to unsigned char) to the given stream.
14 Returns c if successful, EOF otherwise.
15 If a write error occurs, sets the error indicator of the stream is set.
17 int fputc( int c, struct _PDCLIB_file_t * stream )
19 /* FIXME: This is devoid of any error checking (file writeable? r/w
20 constraints honored?) (Text format translations?)
22 stream->buffer[stream->bufidx++] = (char)c;
23 if ( ( stream->bufidx == stream->bufsize ) /* _IOFBF */
24 || ( ( stream->status & _IOLBF ) && (char)c == '\n' ) /* _IOLBF */
25 || ( stream->status & _IONBF ) /* _IONBF */
28 /* buffer filled, unbuffered stream, or end-of-line. */
37 #include <_PDCLIB_test.h>
41 TESTCASE( NO_TESTDRIVER );