I have spent all of yesterday and this morning trying to think of how to do this, and I am still stuck. I don't understand how I can take a std::vector<char> (bytes) and extract values from it by combining the bytes. I have read everything that people have posted but I just don't see how I could do it.
var comment = reader.ReadBytes(24);
I mean how could i go about doing that with 24 bytes (chars) in the vector and store it in a variable to be re-written to another std::vector<char> later?
char a,b,c,d; unsigned long foo = (a << 24) | (b<<16) | (c<<8) | (d<<0);
I was given this idea, but I don't understand it very well, i read up about bitwise operators and such, still a bit hazzy on it. Even if I could do it by using this method with something like this
std::vector<char> test; int index = 0; unsigned long foo = (test.at(index) << 24) | (test.at(index+1) << 16) | (test.at(index+2) << 8) | (test.at(index+3) << 0);
How would i later re-write it back out to a std::vector<char>? Especially if I have to do something with the 24 bytes up above thats going to get very long fast. I mean there must be something else I can be doing here that will make this work.....Write all the bytes to a file and re-read them into an ifstream? Out of ideas....