Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ putc(3S) — sys5 — Apollo Domain/IX SR9.5

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fclose(3S)

ferror(3S)

fopen(3S)

fread(3S)

printf(3S)

puts(3S)

setbuf(3S)



PUTC(3S)                 DOMAIN/IX SYS5                  PUTC(3S)



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

USAGE
     #include <stdio.h>

     int putc(c, stream)
     int c;
     FILE *stream;

     int putchar(c)
     int c;

     int fputc(c, stream)
     int c;
     FILE *stream;

     int putw(w, stream)
     int w;
     FILE *stream;


DESCRIPTION
     Putc writes the character c onto the output stream (at the
     position where the file pointer, if defined, is pointing).
     Putchar(c) is defined as putc(c, stdout).  Putc and putchar
     are macros.

     Fputc behaves like putc, but is a function rather than a
     macro.  Fputc runs more slowly than putc, but it takes less
     space per invocation, and its name can be passed as an argu-
     ment to a function.

     Putw writes the word (i.e., integer) w to the output stream
     (at the position where the file pointer, if defined, is
     pointing).  The size of a word is the size of an integer and
     varies from machine to machine.  Putw neither assumes nor
     causes special alignment in the file.

     Output streams, with the exception of the standard error
     stream stderr, are buffered if the output refers to a file
     and line-buffered if the output refers to a terminal; these
     are default conditions.  The standard error output stream
     stderr is unbuffered by default, but using freopen (see
     fopen(3S)) makes it buffered or line-buffered.  When an out-
     put stream is unbuffered, information is queued for writing
     on the destination file or terminal as soon as written; when
     it is buffered, many characters are saved up and written as
     a block.  When output is line-buffered, each line of output



Printed 12/4/86                                            PUTC-1







PUTC(3S)                 DOMAIN/IX SYS5                  PUTC(3S)



     is queued for writing on the destination terminal as soon as
     the line is completed (that is, as soon as a new-line char-
     acter is written or terminal input is requested).
     Setbuf(3S) can be used to change the stream's buffering
     strategy.

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

       putc(c, *f++);

     doesn't work as you'd expect.  Use fputc instead.

     Because of possible differences in word length and byte ord-
     ering, files written using putw are machine-dependent, and
     may not be readable with getw on a different processor.

DIAGNOSTICS
     On success, these functions return the value they have writ-
     ten.  On failure, they return the constant EOF.  Failure
     occurs if the file stream is not open for writing, or if the
     output file cannot be grown.  Because EOF is a valid
     integer, ferror(3S) should be used to detect putw errors.

RELATED INFORMATION
     fclose(3S), ferror(3S), fopen(3S), fread(3S), printf(3S),
     puts(3S), setbuf(3S)

























PUTC-2                                            Printed 12/4/86





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