FPUTC(DOS) XENIX System V FPUTC(DOS)
Name
fputc, fputchar - Write a character to a stream.
Syntax
#include <stdio.h>
int fputc (c, stream);
int c;
FILE *stream;
int fputchar (c);
int c;
Description
The fputc function writes the single character c to the
output stream at the current position. fputchar is
equivalent to fputc(c, stdout).
Return Value
fputc and fputchar return the character written. A return
value of EOF may indicate an error. However, since the EOF
value is also a legitimate integer value, use ferror to
verify an error condition.
See Also
fgetc(DOS), getc(S), putc(S)
Example
#include <stdio.h>
FILE *stream; char buffer[81]; int i; int ch;
.
.
.
/* The following statements write the contents of a buffer
to ** a stream. Note that the output occurs as a side
effect ** within the for statement's second expression, so
the ** statement body is null. */
for (i = 0; (i < 81) && ((ch = fputc
(buffer[i],stream)) != EOF); i++) ;
/* "fputchar ( )" could be used instead of "fputc (stream)"
** in the for statement above to write the buffer to stdout
** (equivalent to "fputc (stdout)"). */
Notes
fputc and fputchar are identical to putc and putchar, but
are functions, not macros.
These calls must be compiled with the -dos flag.
Page 1 (printed 8/7/87)