Text File

Aucbvax.4077 net.2bsd-bugs utzoo!decvax!ucbvax!dist2 Sun Sep 27 04:03:27 1981 UCB stdio package As has been pointed out in this news group before, our version of stdio does a form of ``line buffering'' on stdout. The manual page for putc.3s has been added to the man directory to document this feature. It should be added to all tapes made before 9/28/81 and is included below.

Carl

.TH PUTC 3S .SH NAME putc, putchar, fputc, putw \- put character or word on a stream .SH SYNOPSIS .B #include <STDIO.H> .PP .B int putc(c, stream) .br .B char c; .br .SM .B FILE .B *stream; .PP .B putchar(c) .PP .B fputc(c, stream) .br .SM .B FILE .B *stream; .PP .B putw(w, stream) .br .SM .B FILE .B *stream; .SH DESCRIPTION .I Putc appends the character .I c to the named output .IR stream . It returns the character written. .PP .I Putchar(c) is defined as .I "putc(c, stdout)." .PP .I Fputc behaves like .I putc, but is a genuine function rather than a macro. It may be used to save on object text. .PP .I Putw appends word (i.e. .BR int ) .I w to the output .IR stream . It returns the word written. .I Putw neither assumes nor causes special alignment in the file. .PP Unlike the original version of .I stdio, the standard stream .I stdout is always buffered; this default may be changed by .IR setbuf (3). The standard stream .I stderr is by default unbuffered unconditionally, but use of .I freopen (see .IR fopen (3)) will cause it to become buffered; .IR setbuf , again, will set the state to whatever is desired. When an output stream is unbuffered information appears on the destination file or terminal as soon as written; when it is buffered many characters are saved up and written as a block. .I Fflush (see .IR fclose (3)) may be used to force the block out early. In addition, all output streams associated with pipes or terminals are automatically flushed before requesting input from a pipe or terminal. .SH "SEE ALSO" fopen(3), fclose(3), getc(3), puts(3), printf(3), fread(3) .SH DIAGNOSTICS These functions return the constant .SM .B EOF upon error. Since this is a good integer, .IR ferror (3) should be used to detect .I putw errors. .SH BUGS Because it is implemented as a macro, .I putc treats a .I stream argument with side effects improperly. In particular `putc(c, *f++);' doesn't work sensibly.

----------------------------------------------------------------- gopher://quux.org/ conversion by John Goerzen <jgoerzen@complete.org> of http://communication.ucsd.edu/A-News/

This Usenet Oldnews Archive article may be copied and distributed freely, provided:

1. There is no money collected for the text(s) of the articles.

2. The following notice remains appended to each copy:

The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996 Bruce Jones, Henry Spencer, David Wiseman.