up | Inhaltsverzeichniss | Kommentar

Manual page for PUTC(3S)

putc, putchar, fputc - put character 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(int w, 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, an int) w to the output stream. It returns the word written. Putw neither assumes nor causes special alignment in the file. Putw is neither ANSI- nor POSIX-compliant.

RETURN VALUE

These functions return the character written. If a write error occurs, the error indicator for the stream is set, errno is set, and EOF is returned. Since EOF is a valid integer, ferror.3s should be used to detect putw errors.

ERRORS

The underlying function of these functions is write(2). The error conditions specified for read(2) apply to them.

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.

SEE ALSO

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


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97