Originally Posted by
Salem
> fp=fopen("C:\\Users\RAJARSHI\Desktop\C programming files\bubble sort and print a fragment.c","r");
You need \\ on ALL your directory components.
when I used
Code:
#include <stdio.h>
#include <stdlib.h>
int main ()
{
FILE *fp;
char ch;
fp=fopen("C:\\Users\\RAJARSHI\\Desktop\\C programming files\\bubble sort and print a fragment.c","r");
if (fp==NULL)
{
puts ("cannot open file");
exit(1);
}
return 0;
}
and
Code:
#include <stdio.h>
int main ()
{
FILE *fp;
char ch;
fp=fopen("C:\\Users\\RAJARSHI\\Desktop\\C programming files\\bubble sort and print a fragment.c","r");
while (1)
{
ch = fgetc(fp);
if (ch == EOF);
break;
printf ("%c",ch);
}
printf ("\n");
fclose(fp);
return 0;
}
The output was a blank screen in both the cases..it didn't open the file !!