c++ - 在 Visual Studio 2019 C++ 中读取 txt 文件
问题描述
我正在尝试为此程序打开一个文件。我曾尝试使用 C:\User... 之类的示例直接对其进行路径处理,但由于某种原因,它仍然说找不到该文件。我已经在 Internet 和 youtube 上查看了使用 C++ 打开文件的方法,而且非常简单。但是我仍然无法读取这个 .txt 文件。也许它与Visual Studio有关?
FILE* in_fp, * fopen();
int main() {
if ((in_fp = fopen("TextFile.txt", "r")) == NULL)
printf("ERROR - cannot open front.in \n");
else
{
getChar();
do {
lex();
} while (nextToken != EOF);
}
}
解决方案
推荐阅读
- python - 如何计算 Pandas 数据框的统计值?
- javascript - 没有 API 时如何从主页的购物车中获取商品
- scripting - 在脚本错误中创建或替换临时表:“超出速率限制:此表的表更新操作过多。”
- java - 与 Scanner (System.in) 相比,使用 bufferedReader 读取输入
- javascript - 迷宫求解器跳过块 Javasript
- mongodb - MongoDB $dateToString 格式表达式 %G 奇怪的行为
- javascript - 如何在html中向生成的列表项添加随机数
- c++ - 使用 vcpkg 安装 GTK3 的主题和图标问题
- python - 调整 QDialog 的大小以适应多显示器显示
- android - 未调用 onPurchasesUpdated 等待购买成功