PUTC(3S) COMMAND REFERENCE PUTC(3S)
NAME
putc, putchar, fputc, putw - put character or word on a
stream
SYNOPSIS
#include <stdio.h>
int putc(c, stream)
char c;
FILE *stream;
putchar(c)
fputc(c, stream)
FILE *stream;
putw(w, stream)
FILE *stream;
DESCRIPTION
putc appends the character c to the named output stream. It
returns the character written.
putchar(c) is defined as putc(c, stdout).
fputc behaves like putc, but is a genuine function rather
than a macro.
putw appends word (that is, int) w to the output stream. It
returns the word written. putw neither assumes nor causes
special alignment in the file.
DIAGNOSTICS
These functions return the constant EOF upon error. Since
this is a good integer, ferror(3s) should be used to detect
putw errors.
CAVEATS
Because it is implemented as a macro, putc treats a stream
argument with side effects improperly. In particular
putc(c, *f++);
doesn't work sensibly.
Errors can occur long after the call to putc.
The de facto standard for both putc and fputc is to return
EOF when an attempt is made to output the character with the
value 255. If this character must be output, change the
definition of _ptr in the iobuf structure in the file
/usr/include/stdio.h from char * to unsigned char *. Be
Printed 3/13/89 1
PUTC(3S) COMMAND REFERENCE PUTC(3S)
aware that this change may break existing software that uses
these functions.
SEE ALSO
fopen(3s), fclose(3s), getc(3s), puts(3s), printf(3s), and
fread(3s).
Printed 3/13/89 2
%%index%%
na:264,119;
sy:383,1422;
de:1805,917;
di:2722,356;
ca:3078,1135;4549,89;
se:4638,289;
%%index%%000000000119