Write string to a stream: how to use fputs
#include <stdio.h>
int main ()
{
FILE *file;
char str[256];
printf ("Enter string to append: ");
fgets (str, 255, stdin);
file = fopen ("my.txt","at");
fputs (str,file);
fclose (file);
return 0;
}
Related examples in the same category