Reputation: 35
In Erlang, the file
module allows one to move the file cursor to a given position by file:position/2
.
But after performing an operation such as file:read_line/1
, the cursor now moves.
Is there any way to get its current location?
Sorry if this seems silly, I'm new to Erlang and I cannot seem to find any relevant function in the module documentation to perform this. Any help will be much appreciated.
Upvotes: 2
Views: 489
Reputation: 20024
To get the current file position, call file:position/2
with the atom cur
as the second argument.
Upvotes: 4