I am trying to write a program which can display the contents of the file then append the content dynamically by user to a text file in C.

Below is the code, but somehow it is working for single line input and not for multi-line input even in the loop.

```
fobj=fopen("test3.txt","a");
if (fobj==NULL)
 {
  printf("Error opening the file.  ");
  exit(0);

 }
int contd;
char buff1[120];
char *chptr;
do
{
printf("Enter line : \n");

gets(buff1);

fputs(buff1,fobj);

printf("Enter Continuation code : ");
scanf("%d",&contd);

}while(contd!=0);

```