bgetc - get a character from a BASIC file


int bgetc()


int doread(fd, s, n)
int fd;
char *s;
unsigned n;


Bgetc returns the next character from the current file or data area (see initio(io)).  It is legal to read sequentially from a random file provided the read is entirely within the buffer. 

Bunget “unreads” the last character read from the current file or data area.  This allows the character to be read again by bgetc.  This function may be used only for a buffered file or the data area and may be used only once before the next read. 

Doread inputs n characters to s from file descriptor fd.  Because read(2) does not guarantee that all n characters will be read, doread calls read repeatedly until the buffer is filled, the end of the file is reached or an I/O error occurs.  This function supports higher level input functions. 

These functions support other input functions and do not directly implement any BASIC functions. 


eof(io), initio(io), inkeyS(io), inputS(io), linein(io)
read(2) in the Unix Programmer’s Manual


Bgetc returns -1 on end-of-file or (in the case of a random file) end-of-record. 

from The Basmark QuickBASIC Programmer’s Manual by Lawrence Leinweber