Crosswind

Untitled

Dec 5th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. int main() {
  2. errno = 0;
  3. const char *filename = "/Users/davidfrenzel/Google Drive/Studium/Semester 1/Programmierung 1/Projects/Uebung4/...";
  4.  
  5. FILE *file;
  6. file = fopen(filename, "r");
  7.  
  8. if (file == NULL) {
  9. fprintf(stderr, "%s\n", strerror(errno));
  10. exit(1);
  11. } else{
  12. printf("The file %s was Found\n", filename);
  13. }
  14. return 0;
  15. }
  16.  
  17. No such file or directory
  18. (You're right!)
  19.  
  20. BUT:
  21. int main() {
  22. errno = 0;
  23. const char *filename = "...";
  24.  
  25. FILE *file;
  26. file = fopen(filename, "r");
  27.  
  28. if (file == NULL) {
  29. fprintf(stderr, "%s\n", strerror(errno));
  30. exit(1);
  31. } else{
  32. printf("The file %s was Found\n", filename);
  33. }
  34. return 0;
  35. }
  36.  
  37. The file ... was Found
Advertisement
Add Comment
Please, Sign In to add comment