O'Reilly logo

C Programming: Visual Quickstart Guide by Marc Liyanage, Larry Ullman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Moving Around Within Binary Files

One of the benefits of working with binary files is that it's very easy to move around within the binary data. When you open a file, C creates a marker pinpointing a location within this file. (This marker is commonly called a pointer but we don't want to confuse you since it's not the same kind of pointer you've been working with.) When you read from a file, the data is read and the marker is moved forward. When you write, the data is added at that location and, again, the marker is moved forward.

You can also move the marker directly to a specific point using fseek():

fseek(fp, offset, starting_point);

The first argument is our file pointer, which refers to an opened binary file. The second argument dictates ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required