12345678910111213
#include <fstream> struct myStruct { char name[12]; int age; }; int main() { myStruct myRecord; fstream iofile("C:\\MYFILE.DAT", ios::binary | ios::out | ios::app); iofile.write((char*)&myRecord, sizeof(myStruct)); iofile.close(); }