locale.library: preparation for implementing native language support
[AROS.git] / compiler / stdc / fputc.c
blob639771a60a018f3f2332870404d49f4fc823f424
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 C99 function fputc().
6 */
7 #include <dos/dos.h>
8 #include <proto/dos.h>
9 #include <errno.h>
11 #include "__stdio.h"
13 /*****************************************************************************
15 NAME */
16 #include <stdio.h>
18 int fputc (
20 /* SYNOPSIS */
21 int c,
22 FILE * stream)
24 /* FUNCTION
25 Write one character to the specified stream.
27 INPUTS
28 c - The character to output
29 stream - The character is written to this stream
31 RESULT
32 The character written or EOF on error.
34 NOTES
36 EXAMPLE
38 BUGS
40 SEE ALSO
42 INTERNALS
44 ******************************************************************************/
46 if (!(stream->flags & __STDCIO_STDIO_WRITE))
48 SetIoErr(ERROR_WRITE_PROTECTED);
49 errno = EACCES;
50 stream->flags |= __STDCIO_STDIO_ERROR;
51 return EOF;
54 if ((stream->flags & __STDCIO_STDIO_APPEND))
55 Seek(stream->fh, 0, OFFSET_END);
57 c = (int)FPutC(stream->fh, c);
59 if (c == EOF)
61 errno = __stdc_ioerr2errno(IoErr());
62 stream->flags |= __STDCIO_STDIO_ERROR;
65 return c;
66 } /* fputc */