#include <iostream>
#include <fstream>
#include <string>
using namespace std;
// - ;
struct Record
{
int number;
string name;
string surname;
};
int main (void)
{
Record rec1;
rec1.name = "Ivan";
rec1.surname = "Ivanov";
rec1.number = 1;
// ;
ofstream fout("db.txt", ios::binary);
// reinterpret_cast;
fout.write(reinterpret_cast<char*>(&rec1), sizeof(Record));
fout.close();
Record rec2;
// ;
ifstream fin("db.txt", ios::binary);
// reinterpret_cast;
fin.read(reinterpret_cast<char*>(&rec2), sizeof(Record));
fin.close();
cout << rec2.number << ". " << rec2.name << " " << rec2.surname << endl;
return 0;
}
, , , , , , .
6.5.
, .
1. .
2. , , , . .
3. . , .
4. , . .
5. , , .
6. .
7. , . .
8. , , .
9. .
10. , , , .
11. , , .
12. , . .
13. , , , .
14. , . .
|
|
15. . , .
16. , , . .
17. , , .
18. , , , i j 1, to 2, fo 4 at 8.
19. , , , .
20. , . , , .
1. . , . , ѻ,
ISBN 5-7940-0045-7.
2. . , ++. CS,
ISBN 5-469-01217-4.
3. . , ++. ,
ISBN 5-7989-0226-2.
4. C. , . , C++. ,
ISBN 5-7940-0070-8.
5. . , . , ++ ,
ISBN 5-8459-1065-X.
6. , ++,
ISBN 978-5-94723-302-5.