Advertisement

Saving to file with BCB

Started by December 13, 2000 06:58 AM
0 comments, last by Danias 24 years ago
I have following struct: struct s { int ID; int sizeX; int sizeY; }; When I want to save this struct to a file I use the following command, took from BCB-Helpfile: fwrite(&s_Struct, sizeof(s), 1, fstream); When I look into the file - using a hex-editor - it doesn''t match the int values. The only way it works right now is by saving every member: fwrite(s.ID, sizeof(int), 1, fstream); . . . and so on... Does anybody have an idea? Thanks!
I noticed something while reading that code - in one example, you passed the data with the & operator, in the other, you didn''t. That might be having an effect...

This topic is closed to new replies.

Advertisement