Electrical and Computer Engineering
8 of 22
UAH
CPE 112
I/O Stream State Test Example
• int main()
• {
• int height, width; 
•      ifstream inFile;
• inFile.open(“mydata.dat”);
• if ( !inFile )
• {
•      cout << “Can’t open the input file.”;
•      return 1;
• }
• inFile >> height >> width;
• return 0;
• }