The first two bytes in the file are the first chunk id.
That would be the ID of this chunk:
GLS_HEADER
The chunk follows those two bytes, and if you look at how the chunk says it's data is set up, it should be obvious how big the chunk is. The chunk may vary in size, but there will be bytes within the chunk that tell you how big each part of the chunk is.
Once you read all the bytes in the chunk you are at the next chunk ID. Read those two bytes in and then read in the chunk data as that particular style of chunk specifies.
That would be the ID of this chunk:
GLS_HEADER
The chunk follows those two bytes, and if you look at how the chunk says it's data is set up, it should be obvious how big the chunk is. The chunk may vary in size, but there will be bytes within the chunk that tell you how big each part of the chunk is.
Once you read all the bytes in the chunk you are at the next chunk ID. Read those two bytes in and then read in the chunk data as that particular style of chunk specifies.