#include #include //_________________________________________________________________ globals char mystring[100]=""; char myfile[]="c:\\Users\\Public\\Documents\\test.txt"; FILE *fp; //_________________________________________________________________ my functions ( methods ) void getString() { printf("Input the string (max 100 char): "); fgets(mystring, sizeof mystring, stdin); printf("The string you entered is : %s\n", mystring); } void saveString() { fp=fopen(myfile, "a"); // create or append at end printf("save to file %s\n",myfile); fprintf(fp,mystring); } //_________________________________________________________________ main int main() { printf("try to get a string from keyboard and write it to the end of a file (append)!\n"); getString(); saveString(); return 0; }