Read/Write struct containing string property to binary file
问题 I am running in to an issue while reading/writing a struct having complex data specifically string. my struct looks like below. struct MyRecord { char name[80]; string location; // <<== note this double balance; unsigned long account_num; }; I use different functions for reading and writing. This is the code I am using to write the data to file struct MyRecord acc; strcpy(acc.name, "R"); acc.location = "newlocation ok"; // <<== note this acc.balance = 1.3; acc.account_num = 34; ofstream