1DPRINTF(3) Linux Programmer's Manual DPRINTF(3)
2
3
4
6 dprintf, vdprintf - print to a file descriptor
7
9 #define _GNU_SOURCE
10 #include <stdio.h>
11
12 int dprintf(int fd, const char *format, ...);
13
14 int vdprintf(int fd, const char *format, va_list ap);
15
17 The functions dprintf() and vdprintf() (as found in the glibc2 library)
18 are exact analogues of fprintf() and vfprintf(), except that they out‐
19 put to a file descriptor fd instead of to a given stream.
20
22 These functions are GNU extensions, not in C or POSIX. Clearly, the
23 names were badly chosen. Many systems (like MacOS) have incompatible
24 functions called dprintf(), usually some debugging version of printf(),
25 perhaps with a prototype like
26
27 void dprintf (int level, const char *format, ...);
28
29 where the first parameter is a debugging level (and output is to
30 stderr). Moreover, dprintf() (or DPRINTF) is also a popular macro name
31 for a debugging printf. So, probably, it is better to avoid this func‐
32 tion in programs intended to be portable.
33
34 A better name would have been fdprintf().
35
37 These functions are GNU extensions.
38
40 printf(3), feature_test_macros(7)
41
42
43
44GNU 2001-12-18 DPRINTF(3)