NAME

linein - read a line

SYNOPSIS

#include <basic/string.h>

linein(prompt, nlflag, str)
struct string *prompt, *str;
int nlflag;

int inline(buf)
char *buf;

DESCRIPTION

Linein reads a newline terminated line from the current file (see initio(io)).  It is legal to read sequentially from a random file provided the read is entirely within the buffer.  If the file is a tty and prompt is not null, the string it points to is echoed before the line is read.  Str must be a pointer to a valid string or initialized (cleared) header; the text buffer is freed (if appropriate), new space is allocated and the line is stored.  After the line is read, if nlflag is set and the file is a full-duplex tty (see io(inc)), a newline is echoed.  This function implements the LINE INPUT and LINE INPUT # statements.  This function resets the current file. 

Inline reads a newline terminated line from the current file into buffer buf and adds a null character.  This function returns the length of the line read.  If the file is a full-duplex tty, erase and kill character processing is performed and characters are echoed except for the newline.  If the file is a half-duplex tty, erase and kill character processing and echoing (including the newline) is performed by the UNIX tty driver.  For a tty with a time limit, the limit is enforced (see alarm(io)).  This function supports linein and input

SEE ALSO

io(inc), string(inc), alarm(io), initio(io), input(io)
line input(stmt), line input #(stmt)

DIAGNOSTICS

Linein generates error 5 (Illegal function call) if the file is open for output only. 

Linein generates error 62 (Input past end) and inline returns -1 in case of a read error or if no newline character is encountered before end-of-file, end-of-record or time-out. 

from The Basmark QuickBASIC Programmer’s Manual by Lawrence Leinweber