Sorry,
couldn't come up with a better title, but here's what I'm trying to do:
I'm making a small console application that reads .pak files (they're from a game). I'm building it in steps, so I don't make errors.
Right now i'm trying to obtain the amount of files stored inside such a .pak file. This is normally done by reading the first 2 bytes from the .pak files, reversing them and then interpreting them as a header.
I'm able to read the first 2 bytes by using an fstream object (ifstream) and read 2 bytes into a char* buffer.
Now I have as question, how can I reverse the 2 bytes, and then interpret it as an integer/short. ?
I tried switching the bytes of place inside the char* (treated as array) but didn't give me the result I wanted.
example :
24 00 should be read as 00 24, and resulting in 36 as integer.
couldn't come up with a better title, but here's what I'm trying to do:
I'm making a small console application that reads .pak files (they're from a game). I'm building it in steps, so I don't make errors.
Right now i'm trying to obtain the amount of files stored inside such a .pak file. This is normally done by reading the first 2 bytes from the .pak files, reversing them and then interpreting them as a header.
I'm able to read the first 2 bytes by using an fstream object (ifstream) and read 2 bytes into a char* buffer.
Now I have as question, how can I reverse the 2 bytes, and then interpret it as an integer/short. ?
I tried switching the bytes of place inside the char* (treated as array) but didn't give me the result I wanted.
example :
24 00 should be read as 00 24, and resulting in 36 as integer.
Comment