Here is my struct:
struct SV {
string masv;
string ho, ten, gioitinh;
string malop;
float ds_diem[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
As you can see it have a few string and an array of float. I've tried to write and load it using these code:
Write:
fout.write((char *)&dssv[i],sizeof(SV));
Read:
fin.read((char *)&sv,sizeof(SV));
They didn't work obviously. And i think it have to do something with char and string. I do try to search for solution, but the codes that posted by the asker are to complex for my to understand a single line, let alone the answer. So a simple and genuine answer would be very appreciated.
PS: Forgot to mention I saved it as a .dat file.