Backup 1 line when using readline()

I am going through a mixed binary/ASCII file implementing UFF58b file format in UFFFiles.jl. It will make my life easier if I can read a line using readline(), call a subroutine and then read the same line again. So I am wondering if there is a command to backup a line and then use readline() again?

I can pass the line into the subroutine but this is more cumbersome, so thought I would ask this question first.

You can call mark(io) on the I/O stream, do your thing involving readline(io), and then call reset(io) to back up in the stream to the marked position so that you can call readline(io) again.

1 Like