我编译通过了,但程序什么都不显示,求大佬帮助,record.txt和本程序在同一个文件夹且有内容。
#include <iostream>
#include <fstream>
#include <cstring>
int main()
{
using namespace std;
ifstream fin("record.txt");
string Rname;
fin >> Rname;
cout << Rname;
fin.close();
system("pause");
return 0;
}编译成功但读取不了文件?
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
3条回答 默认 最新
CSDN专家-cpp_learner 2021-05-23 14:13关注你还没打开文件呢!open
ifstream inFile;
inFile.open("demo.txt"); // 默认当方式打开文件
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报