Byte, character, line count and line position for a specified stream are obtained as follows:
byte_count(
Stream,
N)
unifies N with the total
number of bytes either read or written on the open binary stream Stream.
character_count(
Stream,
N)
unifies N with the total
number of characters either read or written on the open text stream Stream.
line_count(
Stream,
N)
unifies N with the total number of
lines either read or written on the open text stream Stream.
A freshly opened text stream has a line count of 0, i.e. this
predicate counts the number of newlines seen.
line_position(
Stream,
N)
unifies N with the total number of
characters either read or written on the current line of the open
text stream Stream. A fresh line has a
line position of 0, i.e. this
predicate counts the length of the current line.