This is a program for copying content from one file to other file. How to specify EOF in online compiler so that my code will run as expected??
Link for online editor---> https://www.jdoodle.com/c-online-compiler
//code for copying content--->>
#include "stdio.h"
int main()
{
char ch;
FILE *p,*q;
p=fopen("data.txt","w");
while(ch=getchar()!=EOF)
{
putc(ch,p);
}
fclose(p);
p=fopen("data.txt","r");
q=fopen("newdata.txt","w");
while(ch=getc(p)!=EOF)
{
putc(ch,q);
}
fclose(p);
fclose(q);
q=fopen("newdata.txt","r");
while(ch=getc(q)!=EOF)
{
printf("\n%c",ch);
}
}