# Backup 1 line when using readline()

**URL:** <https://discourse.julialang.org/t/backup-1-line-when-using-readline/133826>\
**Category:** Performance\
**Tags:** question, io\
**Created:** [November 12, 2025, 12:30pm UTC](https://discourse.julialang.org/t/backup-1-line-when-using-readline/133826 "2025-11-12T12:30:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jake](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jake/32/46007_2.png) [@Jake](https://discourse.julialang.org/u/Jake)\
**Post date:** [November 12, 2025, 12:30pm UTC](https://discourse.julialang.org/t/backup-1-line-when-using-readline/133826/1 "2025-11-12T12:30:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [November 12, 2025, 12:38pm UTC](https://discourse.julialang.org/t/backup-1-line-when-using-readline/133826/2 "2025-11-12T12:38:16Z")

</div>

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.
