1PUTC(3S)                                                              PUTC(3S)
2
3
4

NAME

6       putc, putchar, fputc, putw - put character or word on a stream
7

SYNOPSIS

9       #include <stdio.h>
10
11       int putc(c, stream)
12       char c;
13       FILE *stream;
14
15       putchar(c)
16
17       fputc(c, stream)
18       FILE *stream;
19
20       putw(w, stream)
21       FILE *stream;
22

DESCRIPTION

24       Putc  appends  the  character c to the named output stream.  It returns
25       the character written.
26
27       Putchar(c) is defined as putc(c, stdout).
28
29       Fputc behaves like putc, but is a genuine function rather than a macro.
30       It may be used to save on object text.
31
32       Putw  appends  word (i.e.  int) w to the output stream.  It returns the
33       word written.  Putw neither assumes nor causes special alignment in the
34       file.
35
36       The standard stream stdout is normally buffered if and only if the out‐
37       put does not refer to a terminal; this default may be changed  by  set‐
38       buf(3).   The  standard stream stderr is by default unbuffered uncondi‐
39       tionally, but use of freopen (see fopen(3)) will  cause  it  to  become
40       buffered;  setbuf,  again,  will  set the state to whatever is desired.
41       When an output stream is unbuffered information appears on the destina‐
42       tion  file  or  terminal  as  soon as written; when it is buffered many
43       characters are saved up and written as a block.  Fflush (see fclose(3))
44       may be used to force the block out early.
45

SEE ALSO

47       fopen(3), fclose(3), getc(3), puts(3), printf(3), fread(3)
48

DIAGNOSTICS

50       These  functions  return  the constant EOF upon error.  Since this is a
51       good integer, ferror(3) should be used to detect putw errors.
52

BUGS

54       Because it is implemented as a macro, putc  treats  a  stream  argument
55       with  side  effects improperly.  In particular `putc(c, *f++);' doesn't
56       work sensibly.
57
58
59
60                                                                      PUTC(3S)
Impressum