为什么fopen文件夹失败?

时间:2019-06-04 07:11:40

标签: c windows visual-studio file

此代码有效。

pFile = fopen("d:\myfile.txt", "w");

此代码无效。

pFile = fopen("d:\ABC\myfile.txt", "w");

我确实有此文件夹d:\ ABC

OsS是Windows 10,使用Visual Studio 2019。

errno是22。

2 个答案:

答案 0 :(得分:0)

//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”;

答案 1 :(得分:-1)

此行解决了问题:

pFile = fopen("D:\ABC\\myfile.txt", "r");