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

相关文章:

  • 2023-03-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-20
  • 2021-12-07
  • 2021-12-06
猜你喜欢
  • 2021-12-22
  • 2022-12-23
  • 2022-03-06
  • 2022-12-23
  • 2021-05-16
  • 2021-07-13
  • 2022-12-23
相关资源
相似解决方案