The code above assumes that the endien-ness of you byte stream and memory are the same. This is normally the case but not always true. For example, the stream could be comming from a file saved in little endian format (like and intel PC) and being processed on big endian machine (like a Mac)... in that case, I think you invert the indices in the stream like so
foo.bytes[0] = stream[3];foo.bytes[1] = stream[2];...
but I''m not 100% sure on that.
---
PAGE FAULT: Please insert "Swap File, Disk 2"
and press any key to continue.