Hi guys, I'm teaching myself read/write in binary mode and am having some difficulty when reading/writing arrays of structs. After I've written data to a file, I read it with another program but I get ridiculous numbers instead of what I originally wrote to it.
The writedata_tofile function save only one record, not all. You should use a loop. The other problem that sizeof(SalesData) doesn't reflect the real size of the record because the string is an object. If you save to file an object then you will save only adress of object. Not the members.
So you should convert the data of string to array o fchar with the help of c_str() and you can query the size of array.
The corp_datafile.read function has similar problem as above.