小编use*_*737的帖子

如何在 C++ 中打开 .txt 文件?

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main () {
  string line;
  ifstream myfile("hey.txt");

  myfile >> line;
  cout << line;
  system("pause");
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

为什么这不打印出我的“hey.txt”文件中的内容?

c++ fstream file ifstream

-1
推荐指数
1
解决办法
4万
查看次数

标签 统计

c++ ×1

file ×1

fstream ×1

ifstream ×1