string类的push_back的应用-按字符存储数据
示例
View Code
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main ()
{
string str;
ifstream file("F:\\log.txt",ios::in);
while (!file.eof())
{
str.push_back(file.get());
}
cout << str;
return 0;
}