ifstream fin ("a.txt" , ios::in|ios::nocreate);if( !fin.open()){ cout << "error open file " << endl ; }while( !fin.eof()){ fin>>对象变量}fin.close() ;