fopen("F:\1.txt","r")为什么会打开失败呢
#include "stdio.h"
#include "conio.h"
{
FILE *fo;
fo=fopen("F:\sun\1.txt","r");
if(fo==NULL)
{
printf("failed to open the file");
}
else
{
printf("congratulations!");
fclose(fo);
}
getch();
}******************************************
#include "Stdio.h"
main()
{
char a[20];
FILE *fp;
printf("enter name of file:");
scanf("%s",a);
fp=fopen(a,"r");
if(fp==NULL)
{
printf("can't open this file:%s",a);
exit(0);
}else
{
printf("Congratulations!The file %s is opened!",a);
fclose(fp);
}
getch();
}
这样为什么输入F:\sun\1.txt就没有错误了呢
*************************