fork download
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <errno.h>
  4. #include <assert.h>
  5. #include <string.h>
  6.  
  7. #define DEBUG
  8.  
  9. #ifdef DEBUG
  10. #define debug_print(fmt, ...) \
  11. do { fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \
  12. __LINE__, __func__, __VA_ARGS__); } while (0)
  13. #else
  14. #define debug_print(fmt,...)
  15. #endif
  16.  
  17. #define FILENAME "test.txt"
  18. int main(void) {
  19. FILE *fp = fopen(FILENAME,"r");
  20. if(!fp) {
  21. debug_print("%s: %s\n",strerror(errno),FILENAME);
  22. exit(EXIT_FAILURE);
  23. }
  24. return 0;
  25. }
  26.  
Runtime error #stdin #stdout #stderr 0s 2420KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
prog.c:21:main(): No such file or directory: test.txt