Make this i386-compatible; massive clean-up.
[unix-history] / usr / src / lib / libc / stdio / putc.3
CommitLineData
411867e7
KB
1.\" Copyright (c) 1990 The Regents of the University of California.
2.\" All rights reserved.
d71fbdb0 3.\"
411867e7
KB
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek.
6.\"
7.\" %sccs.include.redist.man%
8.\"
9.\" @(#)putc.3 6.4 (Berkeley) %G%
10.\"
11.TH PUTC 3 ""
12.UC 7
d71fbdb0 13.SH NAME
411867e7 14fputc, putc, putchar, putw \- put a character or word to a stream
d71fbdb0 15.SH SYNOPSIS
411867e7
KB
16.nf
17.ft B
18#include <stdio.h>
19
20int
21fputc(int c, FILE *stream);
22
23int
24putc(int c, FILE *stream);
25
26int
27putchar(int c);
28
29int
30putw(int w, FILE *stream);
31.ft R
32.fi
d71fbdb0 33.SH DESCRIPTION
411867e7
KB
34.I Fputc
35writes the character
d71fbdb0 36.I c
411867e7
KB
37(converted to an ``unsigned char'')
38to the specified output
d71fbdb0 39.IR stream .
d71fbdb0 40.PP
411867e7
KB
41.I Putc
42acts essentially identically to
43.IR fputc ,
44but is a macro that expands in-line.
d71fbdb0 45.PP
411867e7
KB
46.I Putchar
47is identical to
48.I putc
49with an output stream of
50.BR stdout .
d71fbdb0
KM
51.PP
52.I Putw
411867e7
KB
53writes the specified
54.B int
55to the named output
d71fbdb0 56.IR stream .
411867e7
KB
57.SH "RETURN VALUE"
58These functions return the integer constant
d71fbdb0
KM
59.SM
60.B EOF
411867e7
KB
61upon write error,
62or if an attempt is made to write a read-only stream.
63.I Putw
64returns 0 on success;
65the other functions return the character printed.
66.SH "SEE ALSO"
67ferror(3), fopen(3), getc(3), stdio(3)
d71fbdb0 68.SH BUGS
411867e7
KB
69The size and byte order of an
70.B int
71varies from one machine to another, and
72.I putw
73is not recommended for portable applications.
74.PP
d71fbdb0
KM
75Because it is implemented as a macro,
76.I putc
77treats a
78.I stream
411867e7
KB
79argument with side effects incorrectly.
80In particular, ``putc(c, *f++);'' may not work sensibly
81(although ``putc(*cp++, f);''
82.I does
83work correctly).