>>-LINEIN(--+------+--+-------------------------+--)----------->< +-name-+ +-,--+------+--+--------+-+ +-line-+ +-,count-+
1
or 0
(To understand the input and output functions, see Chapter 14, Input and Output Streams.) If you omit name, the line is read from the default input stream, STDIN. The default count is 1
.
1
.
0
, then no characters are read and a null string is returned.
Example 7.52. Builtin function LINEIN
LINEIN() /* Reads one line from the */ /* default input stream; */ /* usually this is an entry */ /* typed at the keyboard */ myfile = "ANYFILE.TXT" LINEIN(myfile) -> "Current line" /* Reads one line from */ /* ANYFILE.TXT, beginning */ /* at the current read */ /* position. (If first call, */ /* file is opened and the */ /* first line is read.) */ LINEIN(myfile,1,1) -> "first line" /* Opens and reads the first */ /* line of ANYFILE.TXT (if */ /* the file is already open, */ /* reads first line); sets */ /* read position on the */ /* second line. */ LINEIN(myfile,1,0) -> "" /* No read; opens ANYFILE.TXT */ /* (if file is already open, */ /* sets the read position to */ /* the first line). */ LINEIN(myfile, ,0) -> "" /* No read; opens ANYFILE.TXT */ /* (no action if the file is */ /* already open). */ LINEIN("QUEUE:") -> "Queue line" /* Read a line from the queue. */ /* If the queue is empty, the */ /* program waits until a line */ /* is put on the queue. */
Note