Commit | Line | Data |
---|---|---|
e467768b C |
1 | .TH PUTC 3S "19 January 1983" |
2 | .SH NAME | |
3 | putc, 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 | |
30 | appends the character | |
31 | .I c | |
32 | to the named output | |
33 | .IR stream . | |
34 | It returns the character written. | |
35 | .PP | |
36 | .IR Putchar ( c ) | |
37 | is defined as | |
38 | .IR putc ( c , | |
39 | .BR stdout ). | |
40 | .PP | |
41 | .I Fputc | |
42 | behaves like | |
43 | .IR putc , | |
44 | but is a genuine function rather than a macro. | |
45 | .PP | |
46 | .I Putw | |
47 | appends word (that is, | |
48 | .BR int ) | |
49 | .I w | |
50 | to the output | |
51 | .IR stream . | |
52 | It returns the word written. | |
53 | .I Putw | |
54 | neither assumes nor causes special alignment in the file. | |
55 | .SH "SEE ALSO" | |
56 | fopen(3S), | |
57 | fclose(3S), | |
58 | getc(3S), | |
59 | puts(3S), | |
60 | printf(3S), | |
61 | fread(3S) | |
62 | .SH DIAGNOSTICS | |
63 | These functions return the constant | |
64 | .SM | |
65 | .B EOF | |
66 | upon error. Since this is a good integer, | |
67 | .IR ferror (3S) | |
68 | should be used to detect | |
69 | .I putw | |
70 | errors. | |
71 | .SH BUGS | |
72 | Because it is implemented as a macro, | |
73 | .I putc | |
74 | treats a | |
75 | .I stream | |
76 | argument with side effects improperly. In particular | |
77 | .IP "putc(c, *f++);" | |
78 | .PP | |
79 | doesn't work sensibly. | |
80 | .PP | |
81 | Errors can occur long after the call to | |
82 | .IR putc . |