-
Notifications
You must be signed in to change notification settings - Fork 2
/
putc.3
70 lines (69 loc) · 1.26 KB
/
putc.3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
.\" @(#)putc.3s 6.2 (Berkeley) 11/6/85
.\"
.TH PUTC 3 "November 6, 1985"
.AT 3
.SH NAME
putc, putchar, fputc, putw \- put character or word on a stream
.SH SYNOPSIS
.nf
.ft B
#include <stdio.h>
int putc(int \fIc\fP, FILE *\fIstream\fP)
int putchar(int \fIc\fP)
int fputc(int \fIc\fP, FILE *\fIstream\fP)
int putw(int \fIw\fP, FILE *\fIstream\fP)
.ft R
.fi
.SH DESCRIPTION
.B Putc
appends the character
.I c
to the named output
.IR stream .
It returns the character written.
.PP
.BI Putchar( c )
is defined as
.BI putc( c ", stdout)\fR."
.PP
.B Fputc
behaves like
.BR putc ,
but is a genuine function rather than a macro.
.PP
.B Putw
appends word (that is,
.BR int )
.I w
to the output
.IR stream .
It returns the word written.
.B Putw
neither assumes nor causes special alignment in the file.
.SH "SEE ALSO"
.BR fopen (3),
.BR fclose (3),
.BR getc (3),
.BR puts (3),
.BR printf (3),
.BR fread (3).
.SH DIAGNOSTICS
These functions return the constant
.SM
.B EOF
upon error. Since this is a good integer,
.BR ferror (3)
should be used to detect
.B putw
errors.
.SH BUGS
Because it is implemented as a macro,
.B putc
treats a
.I stream
argument with side effects improperly. In particular
`putc(c,\ *f++);'
doesn't work sensibly.
.PP
Errors can occur long after the call to
.BR putc .