// 0809.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <vector> #include <iostream> #include <string> #include <fstream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { string strText; vector<string> svecText; ifstream myinfile("in.txt"); if( !myinfile ) { cerr << "error:unable to open input file: in.txt" << endl; myinfile.clear(); return -1; } while ( getline( myinfile,strText ) ) svecText.push_back(strText); for ( vector<string>::iterator iter= svecText.begin();iter != svecText.end();iter++ ) cout << *iter << endl; return 0; }