#include
#include
#include
using namespace std;
int main()
{
ifstream infile("TestFile.txt");
string word;
string text;
while(infile >> word);
cout << word; //word 是最后一个单词;
infile.clear();
infile.close();
infile.open("TestFile.txt");
while(getline(infile,text));
cout << text; //text 是最后一行;
return 0;
}
#include
#include
#include
using namespace std;
int main()
{
strstream s;
s << "TestFile.txt";
string text;
s >> text;
cout << text;
system("pause");
}