Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ stdio(3S) — bsd — mips UMIPS RISC/os 5.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

close(2)

open(2)

read(2)

write(2)

fread(3S)

fseek(3S)



STDIO(3S-BSD)       RISC/os Reference Manual        STDIO(3S-BSD)



NAME
     stdio - standard buffered input/output package

SYNOPSIS
     #include <stdio.h>

     FILE *stdin;
     FILE *stdout;
     FILE *stderr;

DESCRIPTION
     The functions described in section 3S constitute a user-
     level buffering scheme.  The in-line macros getc and
     putc(3S) handle characters quickly.  The higher level rou-
     tines gets, fgets, scanf, fscanf, fread, puts, fputs,
     printf, fprintf, fwrite all use getc and putc; they can be
     freely intermixed.

     A file with associated buffering is called a stream, and is
     declared to be a pointer to a defined type FILE.  fopen(3S)
     creates certain descriptive data for a stream and returns a
     pointer to designate the stream in all further transactions.
     There are three normally open streams with constant pointers
     declared in the include file and associated with the stan-
     dard open files:

          stdin     standard input file
          stdout    standard output file
          stderr    standard error file

     A constant `pointer' NULL (0) designates no stream at all.

     An integer constant EOF (-1) is returned upon end of file or
     error by integer functions that deal with streams.

     Any routine that uses the standard input/output package must
     include the header file <stdio.h> of pertinent macro defini-
     tions.  The functions and constants mentioned in sections
     labeled 3S are declared in the include file and need no
     further declaration.  The constants, and the following
     `functions' are implemented as macros; redeclaration of
     these names is perilous:  getc, getchar, putc, putchar,
     feof, ferror, fileno.

SEE ALSO
     close(2), open(2), read(2), write(2), fread(3S), fseek(3S).

DIAGNOSTICS
     The value EOF is returned uniformly to indicate that a FILE
     pointer has not been initialized with fopen, input (output)
     has been attempted on an output (input) stream, or a FILE
     pointer designates corrupt or otherwise unintelligible FILE



                        Printed 11/19/92                   Page 1





STDIO(3S-BSD)       RISC/os Reference Manual        STDIO(3S-BSD)



     data.

     For purposes of efficiency, this implementation of the stan-
     dard library has been changed to line buffer output to a
     terminal by default and attempts to do this transparently by
     flushing the output whenever a read(2) from the standard
     input is necessary.  This is almost always transparent, but
     may cause confusion or malfunctioning of programs which use
     standard i/o routines but use read(2) themselves to read
     from the standard input.

     In cases where a large amount of computation is done after
     printing part of a line on an output terminal, it is neces-
     sary to fflush see fclose(3S) the standard output before
     going off and computing so that the output will appear.

BUGS
     The standard buffered functions do not interact well with
     certain other library and system functions, especially vfork
     and abort.



































 Page 2                 Printed 11/19/92





STDIO(3S-BSD)       RISC/os Reference Manual        STDIO(3S-BSD)



LIST OF FUNCTIONS
     Name           Appears on Page                              Description

     clearerr       stream status inquiries                      ferror(3S)
     fclose         close or flush a stream                      fclose(3S)
     fdopen         open a stream                                fopen(3S)
     feof           stream status inquiries                      ferror(3S)
     ferror         stream status inquiries                      ferror(3S)
     fflush         close or flush a stream                      fclose(3S)
     fgets          get a string from a stream                   gets(3S)
     fileno         stream status inquiries                      ferror(3S)
     fopen          open a stream                                fopen(3S)
     fprintf        formatted output conversion                  printf(3S)
     fputc          put character or word on a stream            putc(3S)
     fputs          put a string on a stream                     puts(3S)
     freopen        open a stream                                fopen(3S)
     fscanf          formatted input conversion                  scanf(3S)
     fseek          reposition a stream                          fseek(3S)
     ftell          reposition a stream                          fseek(3S)
     gets           get a string from a stream                   gets(3S)
     printf         formatted output conversion                  printf(3S)
     putc           put character or word on a stream            putc(3S)
     putchar        put character or word on a stream            putc(3S)
     puts           put a string on a stream                     puts(3S)
     putw           put character or word on a stream            putc(3S)
     rewind         reposition a stream                          fseek(3S)
     scanf          formatted input conversion                   scanf(3S)
     setbuf         assign buffering to a stream                 setbuf(3S)
     setbuffer      assign buffering to a stream                 setbuf(3S)
     setlinebuf     assign buffering to a stream                 setbuf(3S)
     sprintf        formatted output conversion                  printf(3S)
     sscanf         formatted input conversion                   scanf(3S)
     ungetc         push character back into input stream        ungetc(3S)






















                        Printed 11/19/92                   Page 3



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