1explain_ferror_or_die(3) Library Functions Manual explain_ferror_or_die(3)
2
3
4
6 explain_ferror_or_die - check stream status and report errors
7
9 #include <libexplain/ferror.h>
10 void explain_ferror_or_die(FILE *fp);
11
13 The explain_ferror_or_die function is used to call the ferror(3) system
14 call. On failure an explanation will be printed to stderr, obtained
15 from explain_ferror(3), and then the process terminates by calling
16 exit(EXIT_FAILURE).
17
18 This function is intended to be used in a fashion similar to the fol‐
19 lowing example:
20 explain_ferror_or_die(fp);
21
22 It is essential that this function cal be placed as close as possible
23 to the I/O code that has caused the problem, otherwise intervening code
24 could have altered the errno global variable.
25
26 fp The fp, exactly as to be passed to the ferror(3) system call.
27
28 Returns:
29 This function only returns on success. On failure, prints an
30 explanation and exits.
31
33 ferror(3)
34 check stream status
35
36 explain_ferror(3)
37 explain ferror(3) errors
38
39 exit(2) terminate the calling process
40
42 libexplain version 1.4
43 Copyright (C) 2008 Peter Miller
44
45
46
47 explain_ferror_or_die(3)