xref: /original-bsd/lib/libc/stdio/putc.3 (revision 4da674f5)
Copyright (c) 1990 The Regents of the University of California.
All rights reserved.

This code is derived from software contributed to Berkeley by
Chris Torek.

%sccs.include.redist.man%

@(#)putc.3 6.4 (Berkeley) 01/20/91

PUTC 3 ""
C 7
NAME
fputc, putc, putchar, putw - put a character or word to a stream
SYNOPSIS
#include <stdio.h>

int
fputc(int c, FILE *stream);

int
putc(int c, FILE *stream);

int
putchar(int c);

int
putw(int w, FILE *stream);
DESCRIPTION
Fputc writes the character c (converted to an ``unsigned char'') to the specified output stream .

Putc acts essentially identically to fputc , but is a macro that expands in-line.

Putchar is identical to putc with an output stream of stdout .

Putw writes the specified int to the named output stream .

"RETURN VALUE"
These functions return the integer constant EOF upon write error, or if an attempt is made to write a read-only stream. Putw returns 0 on success; the other functions return the character printed.
"SEE ALSO"
ferror(3), fopen(3), getc(3), stdio(3)
BUGS
The size and byte order of an int varies from one machine to another, and putw is not recommended for portable applications.

Because it is implemented as a macro, putc treats a stream argument with side effects incorrectly. In particular, ``putc(c, *f++);'' may not work sensibly (although ``putc(*cp++, f);'' does work correctly).