1explain_strtof_or_die(3) Library Functions Manual explain_strtof_or_die(3)
2
3
4
6 explain_strtof_or_die - convert string to number and report errors
7
9 #include <libexplain/strtof.h>
10 float explain_strtof_or_die(const char *nptr, char **endptr);
11 float explain_strtof_on_error(const char *nptr, char **endptr))
12
14 The explain_strtof_or_die function is used to call the strtof(3) system
15 call. On failure an explanation will be printed to stderr, obtained
16 from the explain_strtof(3) function, and then the process terminates by
17 calling exit(EXIT_FAILURE).
18
19 The explain_strtof_on_error function is used to call the strtof(3) sys‐
20 tem call. On failure an explanation will be printed to stderr, obtained
21 from the explain_strtof(3) function, but still returns to the caller.
22
23 nptr The nptr, exactly as to be passed to the strtof(3) system call.
24
25 endptr The endptr, exactly as to be passed to the strtof(3) system
26 call.
27
29 The explain_strtof_or_die function only returns on success, see
30 strtof(3) for more information. On failure, prints an explanation and
31 exits, it does not return.
32
33 The explain_strtof_on_error function always returns the value return by
34 the wrapped strtof(3) system call.
35
37 The explain_strtof_or_die function is intended to be used in a fashion
38 similar to the following example:
39 float result = explain_strtof_or_die(nptr, endptr);
40
42 strtof(3)
43 convert ASCII string to floating‐point number
44
45 explain_strtof(3)
46 explain strtof(3) errors
47
48 exit(2) terminate the calling process
49
51 libexplain version 1.4
52 Copyright (C) 2009 Peter Miller
53
54
55
56 explain_strtof_or_die(3)