#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
FILE *fp;
char str[102] = {0}, strTemp[100];
if((fp=fopen("testfile", "a+")) == NULL){
printf("Cannot open file!\n");
exit(1);
}
printf("Input a string:");
gets(strTemp, fp);
strcat(str, "\n");
strcat(str, strTemp);
fputs(str, fp);
fclose(fp);
return 0;
}