此代码有效。
pFile = fopen("d:\myfile.txt", "w");
此代码不起作用。
pFile = fopen("d:\ABC\myfile.txt", "w");
我确实有这个文件夹 d:\ABC
操作系统是 Windows 10,使用 Visual Studio 2019。
错误号是22。
最佳答案
//these are all the same
char test1[]={'\n', '\a','\t','\\','\'','\"','\0'};
char test2[]={'\N', '\A','\T','\\','\'','\"','\0'};
char test3[]={10,7,9,92,39,34,0};
char test4[]={0x0a,0x07,0x09,0x5c,0x27,0x22,0x00};
char test5[]="\n\a\t\\\'\"";
char test6[]="\N\A\T\\\'\"";
使用 Microsoft 文件
“d:\\ABC\\myfile.txt”;
“d:/ABC/myfile.txt”;
关于c - 为什么 fopen 文件夹失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56439011/