Mega Code Archive

 
Categories / C / File
 

Write string to a stream

#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; }