C++写二进制文件

    CStudent s;
    s.age = 100;
    s.szName = 322342;
    s.szId = 324242;

    ofstream outFile("students.dat", ios::out | ios::binary);

    outFile.write((char*)&s, sizeof(s));
    outFile.close();

 

posted @ 2022-07-08 11:20  阳光下的小土豆  阅读(185)  评论(0编辑  收藏  举报