fork download
  1. #include <stdio.h>
  2.  
  3. void showfile_(FILE *f)
  4. {
  5. char line[65536];
  6. int i = 1;
  7. while (fgets(line, 65536, f) != NULL)
  8. {
  9. printf("%d:%s", i, line);
  10. i++;
  11. }
  12. }
  13.  
  14. void showfile(char* filename)
  15. {
  16. FILE *f = fopen(filename, "r");
  17. if (f != NULL)
  18. {
  19. showfile_(f);
  20. fclose(f);
  21. }
  22. }
  23.  
  24. int main(void)
  25. {
  26. char filename[256];
  27. printf("Please input filename...");
  28. scanf("%s", filename);
  29. showfile(filename);
  30.  
  31. return 0;
  32. }
  33.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty