libstdc++
cstdio
Go to the documentation of this file.
1 // -*- C++ -*- forwarding header.
2 
3 // Copyright (C) 1997-2013 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
9 // any later version.
10 
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
19 
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
24 
25 /** @file include/cstdio
26  * This is a Standard C++ Library file. You should @c \#include this file
27  * in your programs, rather than any of the @a *.h implementation files.
28  *
29  * This is the C++ version of the Standard C Library header @c stdio.h,
30  * and its contents are (mostly) the same as that header, but are all
31  * contained in the namespace @c std (except for names which are defined
32  * as macros in C).
33  */
34 
35 //
36 // ISO C++ 14882: 27.8.2 C Library files
37 //
38 
39 #pragma GCC system_header
40 
41 #include <bits/c++config.h>
42 #include <stdio.h>
43 
44 #ifndef _GLIBCXX_CSTDIO
45 #define _GLIBCXX_CSTDIO 1
46 
47 #ifndef _GLIBCXX_HAVE_GETS
48 extern "C" char* gets (char* __s) __attribute__((deprecated));
49 #endif
50 
51 // Get rid of those macros defined in <stdio.h> in lieu of real functions.
52 #undef clearerr
53 #undef fclose
54 #undef feof
55 #undef ferror
56 #undef fflush
57 #undef fgetc
58 #undef fgetpos
59 #undef fgets
60 #undef fopen
61 #undef fprintf
62 #undef fputc
63 #undef fputs
64 #undef fread
65 #undef freopen
66 #undef fscanf
67 #undef fseek
68 #undef fsetpos
69 #undef ftell
70 #undef fwrite
71 #undef getc
72 #if __cplusplus <= 201103L
73 # undef gets
74 #endif
75 #undef perror
76 #undef printf
77 #undef putc
78 #undef putchar
79 #undef puts
80 #undef remove
81 #undef rename
82 #undef rewind
83 #undef scanf
84 #undef setbuf
85 #undef setvbuf
86 #undef sprintf
87 #undef sscanf
88 #undef tmpfile
89 #undef tmpnam
90 #undef ungetc
91 #undef vfprintf
92 #undef vprintf
93 #undef vsprintf
94 
95 namespace std
96 {
97  using ::FILE;
98  using ::fpos_t;
99 
100  using ::clearerr;
101  using ::fclose;
102  using ::feof;
103  using ::ferror;
104  using ::fflush;
105  using ::fgetc;
106  using ::fgetpos;
107  using ::fgets;
108  using ::fopen;
109  using ::fprintf;
110  using ::fputc;
111  using ::fputs;
112  using ::fread;
113  using ::freopen;
114  using ::fscanf;
115  using ::fseek;
116  using ::fsetpos;
117  using ::ftell;
118  using ::fwrite;
119  using ::getc;
120  using ::getchar;
121 #if __cplusplus <= 201103L
122  // LWG 2249
123  using ::gets;
124 #endif
125  using ::perror;
126  using ::printf;
127  using ::putc;
128  using ::putchar;
129  using ::puts;
130  using ::remove;
131  using ::rename;
132  using ::rewind;
133  using ::scanf;
134  using ::setbuf;
135  using ::setvbuf;
136  using ::sprintf;
137  using ::sscanf;
138  using ::tmpfile;
139  using ::tmpnam;
140  using ::ungetc;
141  using ::vfprintf;
142  using ::vprintf;
143  using ::vsprintf;
144 } // namespace
145 
146 #if _GLIBCXX_USE_C99
147 
148 #undef snprintf
149 #undef vfscanf
150 #undef vscanf
151 #undef vsnprintf
152 #undef vsscanf
153 
154 namespace __gnu_cxx
155 {
156 #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
157  extern "C" int
158  (snprintf)(char * __restrict, std::size_t, const char * __restrict, ...)
159  throw ();
160  extern "C" int
161  (vfscanf)(FILE * __restrict, const char * __restrict, __gnuc_va_list);
162  extern "C" int (vscanf)(const char * __restrict, __gnuc_va_list);
163  extern "C" int
164  (vsnprintf)(char * __restrict, std::size_t, const char * __restrict,
165  __gnuc_va_list) throw ();
166  extern "C" int
167  (vsscanf)(const char * __restrict, const char * __restrict, __gnuc_va_list)
168  throw ();
169 #endif
170 
171 #if !_GLIBCXX_USE_C99_DYNAMIC
172  using ::snprintf;
173  using ::vfscanf;
174  using ::vscanf;
175  using ::vsnprintf;
176  using ::vsscanf;
177 #endif
178 } // namespace __gnu_cxx
179 
180 namespace std
181 {
182  using ::__gnu_cxx::snprintf;
183  using ::__gnu_cxx::vfscanf;
184  using ::__gnu_cxx::vscanf;
185  using ::__gnu_cxx::vsnprintf;
186  using ::__gnu_cxx::vsscanf;
187 } // namespace std
188 
189 #endif // _GLIBCXX_USE_C99
190 
191 #endif