1PUTC(3S) PUTC(3S)
2
3
4
6 putc, putchar, fputc, putw - put character or word on a stream
7
9 #include <stdio.h>
10
11 int putc(c, stream)
12 char c;
13 FILE *stream;
14
15 int putchar(c)
16
17 int fputc(c, stream)
18 FILE *stream;
19
20 int putw(w, stream)
21 FILE *stream;
22
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
31 Putw appends word (that is, int) w to the output stream. It returns
32 the word written. Putw neither assumes nor causes special alignment in
33 the file.
34
36 fopen(3S), fclose(3S), getc(3S), puts(3S), printf(3S), fread(3S)
37
39 These functions return the constant EOF upon error. Since this is a
40 good integer, ferror(3S) should be used to detect putw errors.
41
43 Because it is implemented as a macro, putc treats a stream argument
44 with side effects improperly. In particular
45
46 putc(c, *f++);
47
48 doesn't work sensibly.
49
50 Errors can occur long after the call to putc.
51
52
53
547th Edition November 6, 1985 PUTC(3S)