This is Exactly what Xcode is showing when I'm running the code.
#include <stdio.h>
int main()
{
FILE *f1;
char c;
printf("Data Input\n\n");
f1 = fopen("/Users/karanjeetsinghbagga/Desktop/File Management in C/Fille Management in C/INPUT.txt", "W");
while((c=getchar())!= EOF)
putc(c,f1);
fclose(f1);
printf("\nData Output\n\n");
f1 = fopen("/Users/karanjeetsinghbagga/Desktop/File Management in C/Fille Management in C/INPUT.txt", "R");
while((c=getchar()) !=EOF)
printf("%c",c);
fclose(f1);
return 0;
}
This is the code which I was writing And it is directly copied from E.Balagurusamy Programming in Ansi C. I tried even creating a text file and putting it in the source folder of the code also changed the execution folder for the code but it is not running and when the same code is being run using terminal it is showing -* Segmentation fault: 11