且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2022-08-21 20:43:04

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

示例

46、string类的push_back的应用-按字符存储数据46、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;
}