# Is there a function in Julia similar to Python's \`tell\`?

**URL:** <https://discourse.julialang.org/t/is-there-a-function-in-julia-similar-to-pythons-tell/103308>\
**Category:** New to Julia\
**Created:** [August 28, 2023, 7:45pm UTC](https://discourse.julialang.org/t/is-there-a-function-in-julia-similar-to-pythons-tell/103308 "2023-08-28T19:45:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![frylock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frylock/32/50213_2.png) [@frylock](https://discourse.julialang.org/u/frylock)\
**Post date:** [August 28, 2023, 7:45pm UTC](https://discourse.julialang.org/t/is-there-a-function-in-julia-similar-to-pythons-tell/103308/1 "2023-08-28T19:45:57Z")

</div>

In addition to `seek` on open files, [Python has](https://docs.python.org/3/tutorial/inputoutput.html) a `tell` function … so I could save my place in a file and go back to it? Perhaps I am going about things wrong.

What I’m really trying to do is read in a structure from a file that is organized like this:

```julia
fh = open("myfile.bin")
c_length = ntoh(read(fh, UInt32))
c_type = read(fh, 4)
c_data = read(fh, c_length)
c_crc = ntoh(read(fh, UInt32))

# Then somehow fuse together c_length, c_type and c_crc,
# compute the CRC, then compare to c_crc.

```

To compute the CRC, I need to somehow fuse together `c_length`, `c_type` and `c_data` … which I had planned on doing with `seek`, but this won’t always happen at the beginning of the file … there are many such structures grouped together in the file. I also wanted to minimize the amount of reallocation of things.

Maybe refactor my CRC code to allow updating an on-going computation?

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [August 28, 2023, 7:56pm UTC](https://discourse.julialang.org/t/is-there-a-function-in-julia-similar-to-pythons-tell/103308/2 "2023-08-28T19:56:42Z")

</div>

Maybe `position` [I/O and Network · The Julia Language](https://docs.julialang.org/en/v1/base/io-network/#Base.position)

---

<div class="post-metadata">

**Author:** ![frylock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frylock/32/50213_2.png) [@frylock](https://discourse.julialang.org/u/frylock)\
**Post date:** [August 28, 2023, 8:03pm UTC](https://discourse.julialang.org/t/is-there-a-function-in-julia-similar-to-pythons-tell/103308/3 "2023-08-28T20:03:43Z")

</div>

Instead of dogmatically looking for `tell` 😆 … thanks

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [August 28, 2023, 8:09pm UTC](https://discourse.julialang.org/t/is-there-a-function-in-julia-similar-to-pythons-tell/103308/4 "2023-08-28T20:09:57Z")

</div>

You can also [`mark`](https://docs.julialang.org/en/v1/base/io-network/#Base.mark) a stream and go back to the mark with [`reset`](https://docs.julialang.org/en/v1/base/io-network/#Base.reset-Tuple%7BIO%7D).
