编译成功但读取不了文件?

我编译通过了,但程序什么都不显示,求大佬帮助,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;
}

你还没打开文件呢!open

ifstream inFile;

inFile.open("demo.txt"); // 默认当方式打开文件

你试试输入文件名的绝对路径吧

您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~

如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632