K
Kelly B
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
FILE *fp;
char ch;
fp=fopen("C:\abc.txt","r");
if(fp==NULL)
exit(0);
while(1)
{
ch=fgetc(fp);
if(ch==EOF)
break;
printf("%c",ch);
}
fclose(fp);
return 0;
}
fopen() always returns NULL although the file abc.txt is present
can anyone please suggest me why am i not able to open the file..i
believe i am missing out on something?
(I am using Visual Studio 2005 on Windows)
#include<stdlib.h>
int main(void)
{
FILE *fp;
char ch;
fp=fopen("C:\abc.txt","r");
if(fp==NULL)
exit(0);
while(1)
{
ch=fgetc(fp);
if(ch==EOF)
break;
printf("%c",ch);
}
fclose(fp);
return 0;
}
fopen() always returns NULL although the file abc.txt is present
can anyone please suggest me why am i not able to open the file..i
believe i am missing out on something?
(I am using Visual Studio 2005 on Windows)