c++ - fopen 函数未创建文件 .txt
问题描述
我正在使用 Dev C++ 作为 IDE,Windows 10,这是代码
#include<stdio.h>
main(){
FILE *f;
f=fopen("C:\\Users\\min2\\Documents\\asd.txt", "w"); //(did not work)
//f=fopen("C:/Users/min2/Documents/asd.txt", "w"); (did not work)
//f=fopen("asd.txt", "w"); (did not work)
if(f==NULL)printf("Did not work"); //this is what im getting in the console
else printf("It worked");
fclose(f);
}
它不是创建 .txt。我正在尝试在文档中执行此操作。我在桌子上试过,但它也不起作用。它不创建文件。
解决方案
我只是路过说我放弃了这个,我从来没有找到解决方案
推荐阅读
- python - 如何从 tkinter 中的按钮打开 GUI?
- android - 掉电时Android文件内容更改
- javascript - 我可以在 try-catch 方法中使用 if 语句吗?
- c++ - 如何延迟 C++ 中静态对象(记录器)的销毁?
- arrays - ENUM 和数组声明使用枚举创建对象数组
- graphql - 查询字符串日期不是定义的输入类型
- python - Anaconda Jupyter Notebook Kernel error ImportError: DLL load failed while importing win32api: The specified procedure could not be found
- php - 如果我在有流量的生产 Laravel 站点中将会话驱动程序从文件更改为数据库,会话是否会持续存在?
- .net - 在 dotnet 内存转储中有效地找到数千个对象的根?
- java - 如何在循环 springboot 上手动设置标签名称?