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