line_count/2
line_count(
+Stream,
-Count)
Obtains the total number of lines either input from or output to the open text stream Stream and unifies it with Count.
A valid open text stream.
The resulting line count of the stream.
A freshly opened stream has a line count of 0, i.e. this predicate counts the number of newlines seen. When a line is input from or output to a non-tty Prolog stream, the line count of the Prolog stream is increased by one. Line count for a tty stream reflects the total line input from or output to the tty since the tty is opened to any stream.
The count is reset by set_stream_position/2
.
Stream errors (see ref-iou-sfh-est).
byte_count/2
, character_count/2
, line_position/2
,
stream_position/2
,
set_stream_position/2
,
ref-iou-sfh.