I wrote a simple C program to copy the contact from input file to output one. It works fine. But now I need to insert blank lines between paragraphs in the new file and I can't get how to do this. Can anyone help me out?
Here is code:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
FILE *fp1,*fp2;
char ch;
fp1 = fopen("input.txt","r");
if(fp1==NULL)
{
printf("\nThe file was not found.");
exit(1);
}
fp2 = fopen("output.txt","w");
if(fp2==NULL)
{
printf("\nThe file was not opened.");
exit(1);
}
while(1)
{
ch = fgetc(fp1);
if(ch==EOF)
break;
else
putc(ch,fp2);
}
printf("File copied succesfully!");
fclose(fp1);
fclose(fp2);
}