BSD 4_2 development
[unix-history] / usr / man / man3 / putc.3s
CommitLineData
e467768b
C
1.TH PUTC 3S "19 January 1983"
2.SH NAME
3putc, putchar, fputc, putw \- put character or word on a stream
4.SH SYNOPSIS
5.B #include <stdio.h>
6.PP
7.B int putc(c, stream)
8.br
9.B char c;
10.br
11.SM
12.B FILE
13.B *stream;
14.PP
15.B putchar(c)
16.PP
17.B fputc(c, stream)
18.br
19.SM
20.B FILE
21.B *stream;
22.PP
23.B putw(w, stream)
24.br
25.SM
26.B FILE
27.B *stream;
28.SH DESCRIPTION
29.I Putc
30appends the character
31.I c
32to the named output
33.IR stream .
34It returns the character written.
35.PP
36.IR Putchar ( c )
37is defined as
38.IR putc ( c ,
39.BR stdout ).
40.PP
41.I Fputc
42behaves like
43.IR putc ,
44but is a genuine function rather than a macro.
45.PP
46.I Putw
47appends word (that is,
48.BR int )
49.I w
50to the output
51.IR stream .
52It returns the word written.
53.I Putw
54neither assumes nor causes special alignment in the file.
55.SH "SEE ALSO"
56fopen(3S),
57fclose(3S),
58getc(3S),
59puts(3S),
60printf(3S),
61fread(3S)
62.SH DIAGNOSTICS
63These functions return the constant
64.SM
65.B EOF
66upon error. Since this is a good integer,
67.IR ferror (3S)
68should be used to detect
69.I putw
70errors.
71.SH BUGS
72Because it is implemented as a macro,
73.I putc
74treats a
75.I stream
76argument with side effects improperly. In particular
77.IP "putc(c, *f++);"
78.PP
79doesn't work sensibly.
80.PP
81Errors can occur long after the call to
82.IR putc .