1
0

fgets1.c 515 B

123456789101112131415161718192021
  1. /* fgets1.c -- using fgets() and fputs() */
  2. #include <stdio.h>
  3. #define STLEN 14
  4. int main(void)
  5. {
  6. char words[STLEN];
  7. puts("Enter a string, please.");
  8. fgets(words, STLEN, stdin);
  9. printf("Your string twice (puts(), then fputs()):\n");
  10. puts(words);
  11. fputs(words, stdout);
  12. puts("Enter another string, please.");
  13. fgets(words, STLEN, stdin);
  14. printf("Your string twice (puts(), then fputs()):\n");
  15. puts(words);
  16. fputs(words, stdout);
  17. puts("Done.");
  18. return 0;
  19. }