- C 3 Marks Mehdi Is Writing C Code That When Opening A File Fails Prints The Cause According To Errno File F If 1 (117.04 KiB) Viewed 37 times
(c) [3 marks] Mehdi is writing C code that, when opening a file fails, prints the cause according to errno: FILE *f = if
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
(c) [3 marks] Mehdi is writing C code that, when opening a file fails, prints the cause according to errno: FILE *f = if
question.)
(c) [3 marks] Mehdi is writing C code that, when opening a file fails, prints the cause according to errno: FILE *f = if (f == fopen ("blabhlah", "w") ; NULL) { fprintf(stderr, "boom!\n"); fprintf(stderr, "fopen failed: %s\n", strerror(errno)); } else { } What mistake has Mehdi made? (Even though it may or may not actually break under all circumstances.) Also, suggest one way to rectify it. (No one was electrically shocked in the making of this