ifstream in("test.txt");
vector<string> vs; string s; while(!in.eof()) { in>>s; vs.push_back(s); }
这样的结果是用空格区别test.txt中的元素,然后逐个存储在vector中,直至文件的末端。