for Pset4, recover, I'm trying to read 4 bytes from card.raw into a buffer. I''m testing the first 4 bytes of card.raw with what my buffer contains using gdb, and I'm not getting the same thing. I can't figure out why. Is there something wrong with how I'm using fread, malloc and/or the int*, buffer?
//creates buffer of 4 bytes
int* buffer = malloc(sizeof(int));
//error 2 if buffer is null
if (buffer == NULL)
{
return 2;
}
//reads 4 ints from infile into buffer
fread(buffer, sizeof(int), 1, infile);
Gdb tells me that *buffer is 779381090 (in decimal I believe) each time. I expect the buffer to be 6269 742e (in hex).
Thank you!
6269742e
? Can you explain from where that value comes from?