Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

putchar(3s) [bsd man page]

PUTC(3S)																  PUTC(3S)

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
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. 7th Edition November 6, 1985 PUTC(3S)

Check Out this Related Man Page

PUTC(3S)																  PUTC(3S)

NAME
putc, putchar, fputc, putw - put character or word on a stream SYNOPSIS
#include <stdio.h> int putc(c, stream) char c; FILE *stream; putchar(c) fputc(c, stream) FILE *stream; 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. It may be used to save on object text. Putw appends word (i.e. int) w to the output stream. It returns the word written. Putw neither assumes nor causes special alignment in the file. The standard stream stdout is normally buffered if and only if the output does not refer to a terminal; this default may be changed by set- buf(3). The standard stream stderr is by default unbuffered unconditionally, but use of freopen (see fopen(3)) will cause it to become buffered; setbuf, again, will set the state to whatever is desired. When an output stream is unbuffered information appears on the desti- nation file or terminal as soon as written; when it is buffered many characters are saved up and written as a block. Fflush (see fclose(3)) may be used to force the block out early. SEE ALSO
fopen(3), fclose(3), getc(3), puts(3), printf(3), fread(3) DIAGNOSTICS
These functions return the constant EOF upon error. Since this is a good integer, ferror(3) 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. PUTC(3S)
Man Page