|
|
1.1 root 1: // exios119.cpp
2: // The istream read function
3: #include <fstream.h>
4: #include <fcntl.h>
5: #include <io.h>
6:
7: void main()
8: {
9: struct
10: {
11: double salary;
12: char name[23];
13: } employee;
14:
15: ifstream is( "payroll", ios::binary | ios::nocreate );
16: if( is ) { // ios::operator void*()
17: is.read( (char *) &employee, sizeof( employee ) );
18: cout << employee.name << ' ' << employee.salary << endl;
19: }
20: else {
21: cout << "ERROR: Cannot open file 'payroll'." << endl;
22: }
23: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.