Product SiteDocumentation Site

5.2.4.15. lines


           +-Count--+
>>-lines(--+--------+---)--------------------------------------><
           +-Normal-+

Returns the number of completed lines that available for input. If the stream has already been read with charIn this can include an initial partial line. For persistent streams the count starts at the current read position. In effect, lines reports whether a read action of charIn (see Section 5.2.4.5, “charIn”) or lineIn (see Section 5.2.4.13, “lineIn”) will succeed. (For an explanation of input and output, see Chapter 14, Input and Output Streams.)
For a Queue, lines returns the actual number of lines.

Note

The chars method returns the number of characters in a persistent stream or the presence of data in a transient stream. The lines method determines the actual number of lines by scanning the stream starting at the current position and counting the lines. For large streams, this can be a time-consuming operation. Therefore, avoid the use of the LINES method in the condition of a loop reading a stream. It is recommended that you use the chars method (Section 5.2.4.7, “chars”).
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 "Count".