C examples for File:File Write
Using fgets() and fputs() to read and output string
#include <stdio.h> #define STLEN 10/*from w w w .j a v a 2s .c o m*/ int main(void) { char words[STLEN]; puts("Enter strings (empty line to quit):"); while (fgets(words, STLEN, stdin) != NULL && words[0] != '\n') fputs(words, stdout); puts("Done."); return 0; }