fork download
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<time.h>
  4.  
  5. char wordss[15];
  6. FILE *files;
  7. int i, input;
  8.  
  9. int main() {
  10. srand(time(NULL));
  11.  
  12. printf("Enter anything:\n");
  13. input=rand()%300;
  14.  
  15. files=fopen("save.txt","r");
  16. if (files==NULL)
  17. {
  18. printf("invalid!\n");
  19. return 1;
  20. }
  21.  
  22. for (i=0; i < input && !feof(files); i++)
  23. {
  24. fgets(wordss,20,files);
  25. }
  26.  
  27. printf("%s\n", wordss);
  28. fclose(files);
  29. return 0;
  30. }
  31.  
Runtime error #stdin #stdout 0s 4516KB
stdin
Standard input is empty
stdout
Enter anything:
invalid!