I'm having a problem getting an integer from a char[]. I's a really simple line of code, but I can't see where the problem is.
This is the code:
char* rawd = .....
int resultSize = ((int*)rawd)[0];
cout << "BYTES ::: " << (int)(rawd[0]) << " " << (int)(rawd[1]) << " " << (int)(rawd[2]) << " " << (int)(rawd[3]) << endl;
cout << "SIZE RETURNED :::::: " << resultSize << endl;
This is what is printed:
BYTES ::: 0 0 4 0
SIZE RETURNED :::::: 262144
And I'm expecting resultSize to be 1024.
Why does resultSize contain 262144 intead of 1024?