Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ putc(S) — OpenDesktop Software Development System 1.0.0d

Media Vault

Software Library

Restoration Projects

Artifacts Sought



     PUTC(S)                   UNIX System V                   PUTC(S)



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

     Syntax
          #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
          The putc function 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
          argument to a function.

          putw writes the word (that is, integer) w to the output
          stream (at the position at which 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.

     See Also
          fclose(S), ferror(S), fopen(S), fread(S), printf(S),
          puts(S), setbuf(S), stdio(S)

     Diagnostics
          On success, these functions (with the exception of putw)
          each return the value they have written.  (putw returns
          ferror (stream).) On failure, they return the constant EOF.
          This will occur if the file stream is not open for writing
          or if the output file cannot grow.  Because EOF is a valid
          integer, ferror(S) should be used to detect putw errors.

     Notes
          Because it is implemented as a macro, putc evaluates a
          stream argument more than once.  In particular, putc(c,
          *f++) doesn't work sensibly.  Fputc should be used instead.

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

     Standards Conformance
          fputc, putc and putchar are conformant with:
          AT&T SVID Issue 2, Select Code 307-127;
          The X/Open Portability Guide II of January 1987;
          ANSI X3.159-198X C Language Draft Standard, May 13,
          1988;
          IEEE POSIX Std 1003.1-1988 with C Standard Language-
          Dependent System Support;
          and NIST FIPS 151-1.

          putw is conformant with:
          AT&T SVID Issue 2, Select Code 307-127;
          and The X/Open Portability Guide II of January 1987.




                                             (printed 6/20/89)



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