1explain_ftello(3)          Library Functions Manual          explain_ftello(3)
2
3
4

NAME

6       explain_ftello - explain ftello(3) errors
7

SYNOPSIS

9       #include <libexplain/ftello.h>
10       const char *explain_ftello(FILE *fp);
11       const char *explain_errno_ftello(int errnum, FILE *fp);
12       void explain_message_ftello(char *message, int message_size, FILE *fp);
13       void explain_message_errno_ftello(char *message, int message_size, int
14       errnum, FILE *fp);
15

DESCRIPTION

17       These functions may be used to obtain explanations for errors  returned
18       by the ftello(3) system call.
19
20   explain_ftello
21       const char *explain_ftello(FILE *fp);
22
23       The  explain_ftello  function  is  used  to obtain an explanation of an
24       error returned by the ftello(3) system call. The least the message will
25       contain  is  the  value of strerror(errno), but usually it will do much
26       better, and indicate the underlying cause in more detail.
27
28       The errno global variable will be used to obtain the error value to  be
29       decoded.
30
31       fp      The  original  fp,  exactly  as  passed to the ftello(3) system
32               call.
33
34       Returns:
35               The message explaining the error. This message buffer is shared
36               by  all  libexplain  functions  which do not supply a buffer in
37               their argument list.  This will be overwritten by the next call
38               to  any libexplain function which shares this buffer, including
39               other threads.
40
41       Note: This function is not thread safe, because it shares a return buf‐
42       fer across all threads, and many other functions in this library.
43
44       Example:  This  function is intended to be used in a fashion similar to
45       the following example:
46              off_t result = ftello(fp);
47              if (result < 0)
48              {
49                  fprintf(stderr, "%s\n", explain_ftello(fp));
50                  exit(EXIT_FAILURE);
51              }
52
53       The   above   code   example   is   available   pre-packaged   as   the
54       explain_ftello_or_die(3) function.
55
56   explain_errno_ftello
57       const char *explain_errno_ftello(int errnum, FILE *fp);
58
59       The  explain_errno_ftello  function is used to obtain an explanation of
60       an error returned by the ftello(3) system call. The least  the  message
61       will  contain  is  the value of strerror(errno), but usually it will do
62       much better, and indicate the underlying cause in more detail.
63
64       errnum  The error value to be decoded, usually obtained from the  errno
65               global  variable  just  before this function is called. This is
66               necessary if you need to call any code between the system  call
67               to  be explained and this function, because many libc functions
68               will alter the value of errno.
69
70       fp      The original fp, exactly as  passed  to  the  ftello(3)  system
71               call.
72
73       Returns:
74               The message explaining the error. This message buffer is shared
75               by all libexplain functions which do not  supply  a  buffer  in
76               their argument list.  This will be overwritten by the next call
77               to any libexplain function which shares this buffer,  including
78               other threads.
79
80       Note: This function is not thread safe, because it shares a return buf‐
81       fer across all threads, and many other functions in this library.
82
83       Example: This function is intended to be used in a fashion  similar  to
84       the following example:
85              off_t result = ftello(fp);
86              if (result < 0)
87              {
88                  int err = errno;
89                  fprintf(stderr, "%s\n", explain_errno_ftello(err, fp));
90                  exit(EXIT_FAILURE);
91              }
92
93       The   above   code   example   is   available   pre-packaged   as   the
94       explain_ftello_or_die(3) function.
95
96   explain_message_ftello
97       void explain_message_ftello(char *message, int message_size, FILE *fp);
98
99       The explain_message_ftello function is used to obtain an explanation of
100       an  error  returned by the ftello(3) system call. The least the message
101       will contain is the value of strerror(errno), but usually  it  will  do
102       much better, and indicate the underlying cause in more detail.
103
104       The  errno global variable will be used to obtain the error value to be
105       decoded.
106
107       message The location in which to store the returned message. If a suit‐
108               able message return buffer is supplied, this function is thread
109               safe.
110
111       message_size
112               The size in bytes  of  the  location  in  which  to  store  the
113               returned message.
114
115       fp      The  original  fp,  exactly  as  passed to the ftello(3) system
116               call.
117
118       Example: This function is intended to be used in a fashion  similar  to
119       the following example:
120              off_t result = ftello(fp);
121              if (result < 0)
122              {
123                  char message[3000];
124                  explain_message_ftello(message, sizeof(message), fp);
125                  fprintf(stderr, "%s\n", message);
126                  exit(EXIT_FAILURE);
127              }
128
129       The   above   code   example   is   available   pre-packaged   as   the
130       explain_ftello_or_die(3) function.
131
132   explain_message_errno_ftello
133       void explain_message_errno_ftello(char *message, int message_size, int
134       errnum, FILE *fp);
135
136       The explain_message_errno_ftello function is used to obtain an explana‐
137       tion of an error returned by the ftello(3) system call. The  least  the
138       message  will  contain  is the value of strerror(errno), but usually it
139       will do much better, and indicate the underlying cause in more detail.
140
141       message The location in which to store the returned message. If a suit‐
142               able message return buffer is supplied, this function is thread
143               safe.
144
145       message_size
146               The size in bytes  of  the  location  in  which  to  store  the
147               returned message.
148
149       errnum  The  error value to be decoded, usually obtained from the errno
150               global variable just before this function is  called.  This  is
151               necessary  if you need to call any code between the system call
152               to be explained and this function, because many libc  functions
153               will alter the value of errno.
154
155       fp      The  original  fp,  exactly  as  passed to the ftello(3) system
156               call.
157
158       Example: This function is intended to be used in a fashion  similar  to
159       the following example:
160              off_t result = ftello(fp);
161              if (result < 0)
162              {
163                  int err = errno;
164                  char message[3000];
165                  explain_message_errno_ftello(message, sizeof(message), err,
166                  fp);
167                  fprintf(stderr, "%s\n", message);
168                  exit(EXIT_FAILURE);
169              }
170
171       The   above   code   example   is   available   pre-packaged   as   the
172       explain_ftello_or_die(3) function.
173

SEE ALSO

175       ftello(3)
176               get stream position
177
178       explain_ftello_or_die(3)
179               get stream position and report errors
180
182       libexplain version 1.4
183       Copyright (C) 2013 Peter Miller
184
185
186
187                                                             explain_ftello(3)
Impressum