Trying to parse a file

BlitzMax Forums/BlitzMax Beginners Area/Trying to parse a file

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I'm trying to learn how to correctly parse a 3DS file - for the experience - but having alittle trouble.

It seems the first 2 bytes are Hex numbers describing the current chunk identifer.. which I can get fine.

But the next 4 bytes contain the length of the chunk..

I'm not sure if its suppose to be in hex or just a decimal number, I presume its decimal..

So how do I read all four bytes, and get them to combine to be one number ?

I'm using this:
For cnt = 1 To 4
l_chunk_length = l_chunk_length + ReadByte(l_file)
Next


Which is giving me 34

I've no idea if this is the correct sum.. in a hex editor the 4 bytes are: 20 02 00 00

Is this correct ?