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

NAME

6       explain_snprintf_or_die - formatted output conversion and report errors
7

SYNOPSIS

9       #include <libexplain/snprintf.h>
10       int  explain_snprintf_or_die(char  *data,  size_t data_size, const char
11       *format);
12       int explain_snprintf_on_error(char *data, size_t data_size, const  char
13       *format);
14

DESCRIPTION

16       The  explain_snprintf_or_die  function  is used to call the snprintf(3)
17       system call. On failure an  explanation  will  be  printed  to  stderr,
18       obtained  from  the  explain_snprintf(3) function, and then the process
19       terminates by calling exit(EXIT_FAILURE).
20
21       The explain_snprintf_on_error function is used to call the  snprintf(3)
22       system  call.  On  failure  an  explanation  will be printed to stderr,
23       obtained from the explain_snprintf(3) function, but  still  returns  to
24       the caller.
25
26       data    The  data,  exactly  as  to be passed to the snprintf(3) system
27               call.
28
29       data_size
30               The data_size, exactly as to be passed to the snprintf(3)  sys‐
31               tem call.
32
33       format  The  format,  exactly as to be passed to the snprintf(3) system
34               call.
35

RETURN VALUE

37       The explain_snprintf_or_die  function  only  returns  on  success,  see
38       snprintf(3) for more information. On failure, prints an explanation and
39       exits, it does not return.
40
41       The explain_snprintf_on_error function always returns the value  return
42       by the wrapped snprintf(3) system call.
43

EXAMPLE

45       The  explain_snprintf_or_die function is intended to be used in a fash‐
46       ion similar to the following example:
47              int result = explain_snprintf_or_die(data, data_size, format);
48

SEE ALSO

50       snprintf(3)
51               formatted output conversion
52
53       explain_snprintf(3)
54               explain snprintf(3) errors
55
56       exit(2) terminate the calling process
57
59       libexplain version 1.4
60       Copyright (C) 2010 Peter Miller
61
62
63
64                                                    explain_snprintf_or_die(3)
Impressum