UselessRob
2005.04.15, 10:00 AM
Howdy
Hope you guys don't mind me asking this question here, it's possibly a basic C++ question, but it's giving me a headache.
Basically, I want to use the same data file under Windows and Mac OS X. I thought it'd be fine. I'm using the same code to load the data on both, but I created the datafile under Windows.
Problem is, the data wont load on the mac. It loads the first few bytes of the header part of the file. The header is:
char id[4],
unsigned char
unsigned char
unsigned int
unsigned long -- and here's where it fails. Up til this long all the data is fine, but here the value is 4 in the data file, it comes out as something in the millions.
I'm wondering what could cause this? Would it be the different byte sizes of data types on the 2 systems? Both say int is 4, and so is long, so I don't see why there'd be a problem. And the header is read as one chunk, so I don't get why the first half would be fine, and then the rest stuffed?
It's late, I could just be stupid, and probably am. But any suggestions would be greatly appreciated!
Thanks!
Rob.
Hope you guys don't mind me asking this question here, it's possibly a basic C++ question, but it's giving me a headache.
Basically, I want to use the same data file under Windows and Mac OS X. I thought it'd be fine. I'm using the same code to load the data on both, but I created the datafile under Windows.
Problem is, the data wont load on the mac. It loads the first few bytes of the header part of the file. The header is:
char id[4],
unsigned char
unsigned char
unsigned int
unsigned long -- and here's where it fails. Up til this long all the data is fine, but here the value is 4 in the data file, it comes out as something in the millions.
I'm wondering what could cause this? Would it be the different byte sizes of data types on the 2 systems? Both say int is 4, and so is long, so I don't see why there'd be a problem. And the header is read as one chunk, so I don't get why the first half would be fine, and then the rest stuffed?
It's late, I could just be stupid, and probably am. But any suggestions would be greatly appreciated!
Thanks!
Rob.