Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ putc(3S) — NEXTSTEP 1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fopen(3S)

fclose(3S)

getc(3S)

puts(3S)

printf(3S)

fread(3S)

PUTC(3S)  —  UNIX Programmer’s Manual

NAME

putc, putchar, fputc, putw − put character or word on a stream

SYNOPSIS

#include <stdio.h>

int putc(int c, FILE ∗stream)

int putchar(int c)

int fputc(int c, FILE ∗stream)

int putw(w, stream)
FILE ∗stream;

DESCRIPTION

Putc appends the character c (converted to an unsigned char) to the named output stream. It returns the character written.

Putchar(c) is defined as putc(c, stdout). 

Fputc behaves like putc, but is a genuine function rather than a macro.

Putw appends word (that is, int) w to the output stream. It returns the word written. Putw neither assumes nor causes special alignment in the file.  Putw is not an ANSI C function. 

SEE ALSO

fopen(3S), fclose(3S), getc(3S), puts(3S), printf(3S), fread(3S)

DIAGNOSTICS

These functions return the constant EOF upon error.  Since this is a good integer, ferror(3S) should be used to detect putw errors. 

BUGS

Because it is implemented as a macro, putc treats a stream argument with side effects improperly.  In particular

putc(c, ∗f++);

doesn’t work sensibly. 

Errors can occur long after the call to putc.

ANSI C  —  June 23, 1989

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026