Product SiteDocumentation Site

7.4.41. LINES (Lines Remaining)


                        +-, Normal-+
>>-LINES(--+------+-----+----------+---)-----------------------><
           +-name-+     +-, Count--+

Returns 1 if any data remains between the current read position and the end of the character input stream name. It returns 0 if no data remains. In effect, LINES reports whether a read action that CHARIN (see Section 7.4.14, “CHARIN (Character Input)”) or LINEIN (see Section 7.4.39, “LINEIN (Line Input)”) performs will succeed. (To understand the input and output functions, see Chapter 14, Input and Output Streams.)
The ANSI Standard has extended this function to allow an option: "Count". If this option is used, LINES returns the actual number of complete lines remaining in the stream, irrespective of how long this operation takes.
The option "Normal" returns 1 if there is at least one complete line remaining in the file or 0 if no lines remain.
The default is "Normal".
Here are some examples:

Example 7.55. Builtin function LINES

LINES(myfile)    ->    0    /* at end of the file   */
LINES()          ->    1    /* data remains in the  */
                            /* default input stream */
                            /* STDIN:               */

Note

The CHARS function returns the number of characters in a persistent stream or the presence of data in a transient stream.