Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fclose(3S)

fopen(3S)

fread(3S)

getc(3S)

printf(3S)

puts(3S)

PUTC(3S)  —  Kubota Pacfic Computer Inc. (Standard I/O Library Functions−BSD)

NAME

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

SYNOPSIS

#include <stdio.h>

int putc(c, stream)
char c;
FILE ∗stream;

int putchar(c)

int fputc(c, stream)
FILE ∗stream;

int putw(w, stream)
FILE ∗stream;

DESCRIPTION

putc appends the character c 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. 

SEE ALSO

fclose(3S), fopen(3S), fread(3S), getc(3S), printf(3S), puts(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.

September 02, 1992

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