fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #define MAX 41
  5.  
  6. int main (void)
  7. {
  8. FILE * fp;
  9. char words [MAX];
  10. if ((fp = fopen("text.txt", "a+")) == NULL)
  11. {
  12. fprintf (stdout, "not found \"text.txt\".\n");
  13. exit(EXIT_FAILURE);
  14. }
  15. puts("put any worlds") ;
  16. puts("put # on new line and exit.");
  17. while ((fscanf(stdin,"%40s", words) == 1) && (words[0] != '#'))
  18. fprintf(fp, ":regional_indicator_" "%s" ": " , words);
  19. puts("print:") ;
  20. fprintf(fp, "\n");
  21. rewind(fp); /* return to EOF */
  22. while (fscanf(fp,"%s" , words) == 1)
  23. puts(words) ;
  24. puts("pr sila pishi na si") ;
  25. if (fclose ( fp) != 0)
  26. fprintf (stderr, "error open file\n");
  27. return 0;
  28. }
Runtime error #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
not found "text.txt".