46、string类的push_back的应用按字符存储数据

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;
}

原文地址:https://www.cnblogs.com/mydomain/p/2173155.html