I have a binary file with some layout I know. For example let format be like this:
Use a serialization library. Here are a few: