c语言fopen()中无论怎么设置路径,都找不到指定文件 程序如下:
#include<stdio.h>intmain(){intdata;FILE*fp=fopen("E:\\MassPoints.txt","r");if(!fp){pr...
#include <stdio.h>
int main()
{
int data;
FILE *fp=fopen("E:\\Mass Points.txt","r");
if(!fp)
{
printf("can't open file\n");
return -1;
}
while(!feof(fp))
{
fscanf(fp,"%d",&data);
printf("%4d",data);
}
printf("\n");
fclose(fp);
return 0;
} 总显示can't open file (注:我的Mass Points.txt文件就放在E盘根目录下,里面有下列数据:
23
34
55
66
78
且txt文件扩展名调为显示)
到底是什么原因? 展开
int main()
{
int data;
FILE *fp=fopen("E:\\Mass Points.txt","r");
if(!fp)
{
printf("can't open file\n");
return -1;
}
while(!feof(fp))
{
fscanf(fp,"%d",&data);
printf("%4d",data);
}
printf("\n");
fclose(fp);
return 0;
} 总显示can't open file (注:我的Mass Points.txt文件就放在E盘根目录下,里面有下列数据:
23
34
55
66
78
且txt文件扩展名调为显示)
到底是什么原因? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询