1explain_fgets_or_die(3) Library Functions Manual explain_fgets_or_die(3)
2
3
4
6 explain_fgets_or_die - input of strings and report errors
7
9 #include <libexplain/fgets.h>
10 char *explain_fgets_or_die(char *data, int data_size, FILE *fp);
11
13 The explain_fgets_or_die function is used to call the fgets(3) system
14 call. On failure an explanation will be printed to stderr, obtained
15 from explain_fgets(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_fgets_or_die(data, data_size, fp);
21
22 data The data, exactly as to be passed to the fgets(3) system call.
23
24 data_size
25 The data_size, exactly as to be passed to the fgets(3) system
26 call.
27
28 fp The fp, exactly as to be passed to the fgets(3) system call.
29
30 Returns:
31 This function only returns on success; data when a line is
32 read, or NULL on end‐of‐file. On failure, prints an explana‐
33 tion and exits.
34
36 fgets(3)
37 input of strings
38
39 explain_fgets(3)
40 explain fgets(3) errors
41
42 exit(2) terminate the calling process
43
45 libexplain version 1.4
46 Copyright (C) 2008 Peter Miller
47
48
49
50 explain_fgets_or_die(3)