Wednesday, 25 May 2016

What is a offset in a binary file header in c?


Question posted on stackexchange:
http://stackoverflow.com/questions/37400392/what-is-a-offset-in-a-binary-file-header-in-c/37400667#37400667


Question


I am reading in a binary file which has a fileheader, and then different sections of information, each of those sections also has a section header. First I read the file header, and in the header it has something called a section offset, which says "the offset of the section header table".
This is probably a pretty simple question but what does offset mean?

Answer

Basically it's the n number of bytes from one place to some other place in the file.
This could actually mean different things for different file formats:
Eg, the offset of the data after the beginning of the section header, Or, the offset from of that section from the beginning of the file, Etc...etc....
You're going to have to check the spec for the file format that you're using.

No comments:

Post a Comment