Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ putw(3S) — DG/UX 5.4R3.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exit(2)

lseek(2)

write(2)

reentrant(3)

abort(3C)

fclose(3S)

ferror(3S)

flockfile(3S)

fopen(3S)

fread(3S)

printf(3S)

puts(3S)

setbuf(3S)

stdio(3S)



putc(3S)                       DG/UX 5.4R3.00                       putc(3S)


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

SYNOPSIS
       #include <stdio.h>

       int putc (int c, FILE *stream);

       int putcunlocked (int c, FILE *stream);

       int putchar (int c);

       int putcharunlocked (int c);

       int fputc (int c, FILE *stream);

       int putw (int w, FILE *stream);

DESCRIPTION
       putc and putcunlocked write c (converted to an unsigned char) onto
       the output stream [see intro(3)] at the position where the file
       pointer (if defined) is pointing, and advances the file pointer
       appropriately.  If the file cannot support positioning requests, or
       stream was opened with append mode, the character is appended to the
       output stream.  putchar(c) and putcharunlocked(c) are defined as
       putc(c, stdout) and putcunlocked(c, stdout) respectively.  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 (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.

       The putcunlocked and putcharunlocked functions work like putc and
       putchar except they are not reentrant and must be used within a scope
       protected by calls to flockfile and funlockfile.

   Considerations for Threads Programming














Licensed material--property of copyright holder(s)                         1




putc(3S)                       DG/UX 5.4R3.00                       putc(3S)


                 +-----------------+-----------------------------+
                 |                 |                      async- |
                 |function         | reentrant   cancel   cancel |
                 |                 |              point    safe  |
                 +-----------------+-----------------------------+
                 |fputc            |     Y          Y        N   |
                 |putc             |     Y          Y        N   |
                 |putcunlocked    |     N          -        -   |
                 |putchar          |     Y          Y        N   |
                 |putcharunlocked |     N          -        -   |
                 |putw             |     Y          N        N   |
                 +-----------------+-----------------------------+
SEE ALSO
       exit(2), lseek(2), write(2), reentrant(3), abort(3C), fclose(3S),
       ferror(3S), flockfile(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 result will occur, for
       example, if the file stream is not open for writing or if the output
       file cannot grow.

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.

       Functions exist for all the above defined macros.  To get the
       function form, the macro name must be undefined (e.g., #undef putc).






















Licensed material--property of copyright holder(s)                         2


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