bputc - put a character to a BASIC file


char c;

bputs(s, n)
char *s;
int n;

btermcap(s, n, row, col)
char *s;
int n, row, col;

int getrow();

int getcol();

dowrite(fd, s, n)
int fd, n;
char *s;


Bputc writes the character c to the current file (see initio(io)).  If this character would cause the line to be wider than the width of the file (if defined) then a newline is written before the character is written.  A tab character (octal 011) is expanded into blanks.  It is legal to write sequentially to a random file provided the write is entirely within the buffer. 

Bputs writes n characters from the null-terminated string, s, to the current file.  The purpose of this function is to output characters at optimum speed eliminating the overhead in bputc of dealing with special characters and line wrap-around.  Bputs does check for these conditions and calls bputc when necessary.  A chunk of ordinary characters that fits on the current line is output quickly: for unbuffered files a single write is used (see write(2)), and for buffered files a tight loop is used.  Of course, all optimizations have their costs: bputs will actually prove slower than a succession of bputc calls for a string of special characters.  So bputs ought to be used thoughtfully if throughput is important. 

Btermcap outputs n characters from s to the current file without interpretation and sets the line to row and the position to colGetrow returns the line (row) number and getcol returns the position (column) number of the current file (presumably a CRT).  These function support cls(misc). 

Dowrite outputs n characters from s to file descriptor fd.  This function supports higher level output and echoing functions. 

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


bwrite(io), comma(io), initio(io), input(io), linein(io), newlin(io), print(io), printu(io), spc(io), tab(io), cls(misc), files(misc)
write(2) in the UNIX Programmerís Manual


Bputc, bputs and btermcap generate error 50 (FIELD overflow) on end-of-record for a random file. 

from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber