Product Site

7.4.42. LINES (Lines Remaining)

Returns 1 if any data remains between the current read position and the end of the character input stream name, and no option or option Normal is specified. It returns 0 if no data remains. As such, LINES reports whether a read action that CHARIN or LINEIN performs will succeed. Option Normal is the default.

If option Count is specified, LINES returns the actual number of lines remaining in the stream, irrespective of how long this operation takes.

For an explanation of input and output, see Chapter 14, Input and Output Streams.

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.