OSDN Git Service

4a72516e5a9693b4ed2696b070784c047dcad517
[linuxjm/LDP_man-pages.git] / original / 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 2010-09-15 "GNU" "Linux Programmer's Manual"
26 .SH NAME
27 dprintf, vdprintf \- print to a file descriptor
28 .SH SYNOPSIS
29 .B #include <stdio.h>
30 .sp
31 .BI "int dprintf(int " fd ", const char *" format ", ...);"
32 .sp
33 .BI "int vdprintf(int " fd ", const char *" format ", va_list " ap );
34 .sp
35 .in -4n
36 Feature Test Macro Requirements for glibc (see
37 .BR feature_test_macros (7)):
38 .in
39 .sp
40 .BR dprintf (),
41 .BR vdprintf ():
42 .PD 0
43 .ad l
44 .RS 4
45 .TP 4
46 Since glibc 2.10:
47 _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
48 .TP
49 Before glibc 2.10:
50 _GNU_SOURCE
51 .RE
52 .ad
53 .PD
54 .SH DESCRIPTION
55 The functions
56 .BR dprintf ()
57 and
58 .BR vdprintf ()
59 (as found in the glibc2 library) are exact analogs of
60 .BR fprintf (3)
61 and
62 .BR vfprintf (3),
63 except that they output to a file descriptor
64 .I fd
65 instead of to a
66 .I stdio
67 stream.
68 .SH "CONFORMING TO"
69 These functions are GNU extensions that are nowadays specified in
70 POSIX.1-2008.
71 .\" .SH NOTES
72 .\" These functions are GNU extensions, not in C or POSIX.
73 .\" Clearly, the names were badly chosen.
74 .\" Many systems (like MacOS) have incompatible functions called
75 .\" .BR dprintf (),
76 .\" usually some debugging version of
77 .\" .BR printf (3),
78 .\" perhaps with a prototype like
79 .\"
80 .\" .BI "void dprintf(int level, const char *" format ", ...);"
81 .\"
82 .\" where the first argument is a debugging level (and output is to
83 .\" .IR stderr ).
84 .\" Moreover,
85 .\" .BR dprintf ()
86 .\" (or
87 .\" .BR DPRINTF )
88 .\" is also a popular macro name for a debugging printf.
89 .\" So, probably, it is better to avoid this function in programs
90 .\" intended to be portable.
91 .\"
92 .\" A better name would have been
93 .\" .BR fdprintf ().
94 .SH "SEE ALSO"
95 .BR printf (3)