Character count, line count and line position for a specified stream are obtained as follows:
character_count(
Stream,
N)
unifies N with the total
number of characters either read or written on the open stream Stream.
line_count(
Stream,
N)
unifies N with the total number of
lines either read or written on the open stream Stream.
A freshly opened stream has a line count of 1.
line_position(
Stream,
N)
unifies N with the total number of
characters either read or written on the current line of the open
stream Stream. A fresh line has a
line position of 0.