Im doing some binary datafile processing, and im reading the whole file in as a vector of unsigned bytes. If i were to populate a 4 byte object like an unsigned int one byte at a time how would i go about it?
Let me illustrate what im trying to do:
Code:
std::vector<unsigned char> FileContents;
//Assume i populate FileContents here, and its correctly filled.
unsigned int test; //4 bytes, i want to set the first byte to FileContents[5] and the second to [6] etc
//obviously this is incorrect, im just fishing for the correct way to do it.
void * TheVoid;
TheVoid = &test;
TheVoid[0] = *FileContents[5];
TheVoid[1] = *FileContents[6];
...
Does this make sense? Am i missing some critical thing that will make my life easier?
Thanks for your time.
.