]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/dprintf.3
db8600c1f5e9b6cb535a82a31fca8fc6b1818bd5
[thirdparty/man-pages.git] / man3 / dprintf.3
1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" Text fragments inspired by Martin Schulze <joey@infodrom.org>.
24 .\"
25 .TH DPRINTF 3 2001-12-18 "GNU" "Linux Programmer's Manual"
26 .SH NAME
27 dprintf, vdprintf \- print to a file descriptor
28 .SH SYNOPSIS
29 .B #define _GNU_SOURCE
30 .br
31 .B #include <stdio.h>
32 .sp
33 .BI "int dprintf(int " fd ", const char *" format ", ...);"
34 .sp
35 .BI "int vdprintf(int " fd ", const char *" format ", va_list " ap );
36 .SH DESCRIPTION
37 The functions
38 .BR dprintf ()
39 and
40 .BR vdprintf ()
41 (as found in the glibc2 library) are exact analogues of
42 .BR fprintf (3)
43 and
44 .BR vfprintf (3),
45 except that they output to a file descriptor
46 .I fd
47 instead of to a given stream.
48 .SH "CONFORMING TO"
49 These functions are GNU extensions.
50 .SH NOTES
51 These functions are GNU extensions, not in C or POSIX.
52 Clearly, the names were badly chosen.
53 Many systems (like MacOS) have incompatible functions called
54 .BR dprintf (),
55 usually some debugging version of
56 .BR printf (3),
57 perhaps with a prototype like
58
59 .BI "void dprintf(int level, const char *" format ", ...);"
60
61 where the first parameter is a debugging level (and output is to
62 .IR stderr ).
63 Moreover,
64 .BR dprintf ()
65 (or
66 .BR DPRINTF )
67 is also a popular macro name for a debugging printf.
68 So, probably, it is better to avoid this function in programs
69 intended to be portable.
70
71 A better name would have been
72 .BR fdprintf ().
73 .SH "SEE ALSO"
74 .BR printf (3),
75 .BR feature_test_macros (7)