GETC, GETW, FOPEN (III)      3/15/72      GETC, GETW, FOPEN (III)

NAME            getw, getc, fopen  --  buffered input

SYNOPSIS        mov     $filename,r0

                jsr     r5,fopen; iobuf

                jsr     r5,getc; iobuf

                (character in r0)

                jsr     r5,getw; iobuf

                (word in r0)

DESCRIPTION     These routines are used to provide a buffered in-

                put facility.  iobuf is the address of a 518(10)

                byte buffer area whose contents are maintained by

                these routines.  Its format is:

                ioptr:  .=.+2           / file descriptor

                        .=.+2           / characters left in buffer

                        .=.+2           / ptr to next character

                        .=.+512.        / the buffer

                fopen may be called initially to open the file.

                On return, the error bit (c-bit) is set if the

                open failed.  If fopen is never called, get will

                read from the standard input file.

                getc returns the next byte from the file in r0.

                The error bit is set on end of file or a read er-


                getw returns the next word in r0.  getc and getw

                may be used alternately; there are no odd/even


                iobuf must be provided by the user; it must be on

                a word boundary.

                To reuse the same buffer for another file, it is

                sufficient to close the original file and call

                fopen again.

FILES           kept in /lib/liba.a

SEE ALSO        open(II), read(II), putc(III)

DIAGNOSTICS     c-bit set on EOF or error

BUGS            --