i'm writing a program that takes input as sequence of characters using getchar() and create pro.cpp source code file using fopen() and putc() functions.
when i compile this source code files created by this program it generate error. this error can be resolved if i start int main{} from new line. so i need to enter new line character between #include and int main{ }
i don't know how to do it.
#include<stdio.h>
int main()
{
FILE *fp;
char pgm[100];
char *p_pgm;
p_pgm=pgm;
printf("Enter the program as a input");
while((*p_pgm=getchar())!=10)
p_pgm++;
*p_pgm ='\0';
fp =fopen("e:\\pro.cpp","w");
while(*p_pgm!='\0')
putc(*p_pgm++,fp);
fclose(fp);
}