1explain_fprintf_or_die(3) Library Functions Manual explain_fprintf_or_die(3)
2
3
4
6 explain_fprintf_or_die - formatted output conversion and report errors
7
9 #include <libexplain/fprintf.h>
10 int explain_fprintf_or_die(FILE *fp, const char *format, ...);
11 int explain_fprintf_on_error(FILE *fp, const char *format, ...);
12
14 The explain_fprintf_or_die function is used to call the fprintf(3) sys‐
15 tem call. On failure an explanation will be printed to stderr, obtained
16 from the explain_fprintf(3) function, and then the process terminates
17 by calling exit(EXIT_FAILURE).
18
19 The explain_fprintf_on_error function is used to call the fprintf(3)
20 system call. On failure an explanation will be printed to stderr,
21 obtained from the explain_fprintf(3) function, but still returns to the
22 caller.
23
24 fp The fp, exactly as to be passed to the fprintf(3) system call.
25
26 format The format, exactly as to be passed to the fprintf(3) system
27 call.
28
30 The explain_fprintf_or_die function only returns on success, see
31 fprintf(3) for more information. On failure, prints an explanation and
32 exits, it does not return.
33
34 The explain_fprintf_on_error function always returns the value return
35 by the wrapped fprintf(3) system call.
36
38 The explain_fprintf_or_die function is intended to be used in a fashion
39 similar to the following example:
40 int result = explain_fprintf_or_die(fp, format, ...);
41
43 fprintf(3)
44 formatted output conversion
45
46 explain_fprintf(3)
47 explain fprintf(3) errors
48
49 exit(2) terminate the calling process
50
52 libexplain version 0.40
53 Copyright (C) 2010 Peter Miller
54
55
56
57 explain_fprintf_or_die(3)