filel - printer utilities



short lpos()


Filel sets the current file to the line printer for subsequent I/O (see initio(io)).  If the line printer is not yet open, this function opens it.  Under UNIX, a variety of spoolers and drivers are used to interface printers, so a flexible system is needed to open the printer.  The value of the environment variable LPR is taken as a command to the UNIX shell (see sh(1)).  This command must read data from its standard input and see that it arrives at the printer.  This function locates and reads the environment variable, creates a pipe and a process and invokes the shell.  This function also creates a buffer for the pipe.  Because some applications can not tolerate delay in receiving characters at the printer, the buffer used is of trivial length and never holds characters between I/O functions.  To be effective, such an application must assign to LPR a command which itself does not buffer data.  This function supports output to the line printer. 

Lpos returns the current column number of the line printer.  At the level of the userís code, columns are numbered starting with one.  If the line printer is not yet open, this function returns one.  This function implements the BASIC LPOS function. 


lpos(func), lprint(stmt)
sh(1) in the UNIX Programmerís Manual


Filel generates error 5 (Illegal function call) if the environment variable LPR does not exist or is empty.  If the command is wrong, a subsequent write attempt will generate an error. 

from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber