Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ standard(3) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

close

lseek

open

pipe

read, readx

write, writex

ctermid

cuserid

fclose, fflush

feof, ferror, clearerr, fileno

fopen, freopen, fdopen

fread, fwrite

fseek, rewind, ftell

getc, fgetc, getchar, getw

gets, fgets

popen, pclose

printf, fprintf, sprintf, NLprintf, NLfprintf, NLsprintf

putc, putchar, fputc, putw

puts, fputs

scanf, fscanf, sscanf, NLscanf, NLfscanf, NLsscanf

setbuf, setvbuf

system

tmpfile

tmpnam, tempnam

ungetc

     standard i/o library

Purpose

     Performs standard buffered input and output operations.

Library

     Standard I/O Library (libc.a)

Syntax

     #include <stdio.h>

     FILE *stdin, *stdout, *stderr;

Description

     These macros  and subroutines provide an  efficient user-
     level I/O buffering scheme.

     The  in-line  macros  getc  and  putc  handle  characters
     quickly.  The  following macros  and subroutines  all use
     the getc and putc macros:

         getchar macro                             fscanf subroutine
         putchar macro                             fwrite subroutine
         fgetc subroutine                          gets subroutine
         fgets subroutine                          getw subroutine
         fprintf subroutine                        printf subroutine
         fputc subroutine                          puts subroutine
         fputs subroutine                          putw subroutine
         fread subroutine                          scanf subroutine

A file with associated  buffering is called a stream and is  declared to be a
pointer to the  defined type FILE.  The fopen  subroutine constructs descrip-
tive data for a  stream and returns a pointer to designate  the stream in all
further transactions.  Normally,  there are three open  streams with constant
pointers declared in the stdio.h header file and associated with the standard
open streams:

    stdin     Standard input stream
    stdout    Standard output stream
    stderr    Standard error output stream.

The constant NULL (0) designates a  special pointer value that does not point
to any data structure.

Most integer subroutines that deal with  streams return the constant EOF (-1)
upon end-of-file  or an error.   See each individual subroutine  for detailed
information about the return value.

Programs that use  this input/output package must include the  header file of
pertinent macro definitions, as follows:

     #include <stdio.h>

The subroutines and constants in the input/output package are declared in the
header file and  do not need any further declaration.   The constants and the
following routines are  implemented as macros.  Redeclaration  of these names
is not allowed.

         getc                                      feof
         getchar                                   ferror
         putc                                      clearerr
         putchar                                   fileno

Warning:  Invalid  stream pointers  usually cause errors,  possibly including
program termination.   Individual subroutine  descriptions describe  the pos-
sible error conditions.

Related Information

In  this book:   "close,"  "lseek," "open,"  "pipe,"  "read, readx,"  "write,
writex,"  "ctermid," "cuserid,"  "fclose, fflush,"  "feof, ferror,  clearerr,
fileno," "fopen,  freopen, fdopen," "fread, fwrite,"  "fseek, rewind, ftell,"
"getc,  fgetc,  getchar,  getw,"  "gets, fgets,"  "popen,  pclose,"  "printf,
fprintf,  sprintf, NLprintf,  NLfprintf, NLsprintf,"  "putc, putchar,  fputc,
putw," "puts,  fputs," "scanf, fscanf, sscanf,  NLscanf, NLfscanf, NLsscanf,"
"setbuf, setvbuf," "system," "tmpfile," "tmpnam, tempnam," and "ungetc."

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