1explain_fseek_or_die(3) Library Functions Manual explain_fseek_or_die(3)
2
3
4
6 explain_fseek_or_die - reposition a stream and report errors
7
9 #include <libexplain/fseek.h>
10 void explain_fseek_or_die(FILE *fp, long offset, int whence);
11 int explain_fseek_on_error(FILE *fp, long offset, int whence);
12
14 The explain_fseek_or_die function is used to call the fseek(3) system
15 call. On failure an explanation will be printed to stderr, obtained
16 from the explain_fseek(3) function, and then the process terminates by
17 calling exit(EXIT_FAILURE).
18
19 The explain_fseek_on_error function is used to call the fseek(3) system
20 call. On failure an explanation will be printed to stderr, obtained
21 from the explain_fseek(3) function, but still returns to the caller.
22
23 fp The fp, exactly as to be passed to the fseek(3) system call.
24
25 offset The offset, exactly as to be passed to the fseek(3) system
26 call.
27
28 whence The whence, exactly as to be passed to the fseek(3) system
29 call.
30
32 The explain_fseek_or_die function only returns on success, see fseek(3)
33 for more information. On failure, prints an explanation and exits, it
34 does not return.
35
36 The explain_fseek_on_error function always returns the value return by
37 the wrapped fseek(3) system call.
38
40 The explain_fseek_or_die function is intended to be used in a fashion
41 similar to the following example:
42 explain_fseek_or_die(fp, offset, whence);
43
45 fseek(3)
46 reposition a stream
47
48 explain_fseek(3)
49 explain fseek(3) errors
50
51 exit(2) terminate the calling process
52
54 libexplain version 1.4
55 Copyright (C) 2010 Peter Miller
56
57
58
59 explain_fseek_or_die(3)