Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ () — Motorola System V 88k Release 3.2 Version 1.2C

Media Vault

Software Library

Restoration Projects

Artifacts Sought



  PUTC(3S)        (C Programming Language Utilities)       PUTC(3S)



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

  SYNOPSIS
       #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
       argument to a function.

       Putw writes the word (i.e. 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


  Page 1                                                   May 1989


















  PUTC(3S)        (C Programming Language Utilities)       PUTC(3S)



       fclose(3S), ferror(3S), fopen(3S), fread(3S), printf(3S),
       puts(3S), setbuf(3S), stdio(3S).

  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(3S) should be used to detect putw errors.

  CAVEATS
       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.
























  Page 2                                                   May 1989
















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