libstdc++
cstdio
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 #undef getchar
73 #undef gets
74 #undef perror
75 #undef printf
76 #undef putc
77 #undef putchar
78 #undef puts
79 #undef remove
80 #undef rename
81 #undef rewind
82 #undef scanf
83 #undef setbuf
84 #undef setvbuf
85 #undef sprintf
86 #undef sscanf
87 #undef tmpfile
88 #undef tmpnam
89 #undef ungetc
90 #undef vfprintf
91 #undef vprintf
92 #undef vsprintf
93 
94 namespace std
95 {
96  using ::FILE;
97  using ::fpos_t;
98 
99  using ::clearerr;
100  using ::fclose;
101  using ::feof;
102  using ::ferror;
103  using ::fflush;
104  using ::fgetc;
105  using ::fgetpos;
106  using ::fgets;
107  using ::fopen;
108  using ::fprintf;
109  using ::fputc;
110  using ::fputs;
111  using ::fread;
112  using ::freopen;
113  using ::fscanf;
114  using ::fseek;
115  using ::fsetpos;
116  using ::ftell;
117  using ::fwrite;
118  using ::getc;
119  using ::getchar;
120  using ::gets;
121  using ::perror;
122  using ::printf;
123  using ::putc;
124  using ::putchar;
125  using ::puts;
126  using ::remove;
127  using ::rename;
128  using ::rewind;
129  using ::scanf;
130  using ::setbuf;
131  using ::setvbuf;
132  using ::sprintf;
133  using ::sscanf;
134  using ::tmpfile;
135  using ::tmpnam;
136  using ::ungetc;
137  using ::vfprintf;
138  using ::vprintf;
139  using ::vsprintf;
140 } // namespace
141 
142 #if _GLIBCXX_USE_C99
143 
144 #undef snprintf
145 #undef vfscanf
146 #undef vscanf
147 #undef vsnprintf
148 #undef vsscanf
149 
150 namespace __gnu_cxx
151 {
152 #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
153  extern "C" int
154  (snprintf)(char * __restrict, std::size_t, const char * __restrict, ...)
155  throw ();
156  extern "C" int
157  (vfscanf)(FILE * __restrict, const char * __restrict, __gnuc_va_list);
158  extern "C" int (vscanf)(const char * __restrict, __gnuc_va_list);
159  extern "C" int
160  (vsnprintf)(char * __restrict, std::size_t, const char * __restrict,
161  __gnuc_va_list) throw ();
162  extern "C" int
163  (vsscanf)(const char * __restrict, const char * __restrict, __gnuc_va_list)
164  throw ();
165 #endif
166 
167 #if !_GLIBCXX_USE_C99_DYNAMIC
168  using ::snprintf;
169  using ::vfscanf;
170  using ::vscanf;
171  using ::vsnprintf;
172  using ::vsscanf;
173 #endif
174 } // namespace __gnu_cxx
175 
176 namespace std
177 {
178  using ::__gnu_cxx::snprintf;
179  using ::__gnu_cxx::vfscanf;
180  using ::__gnu_cxx::vscanf;
181  using ::__gnu_cxx::vsnprintf;
182  using ::__gnu_cxx::vsscanf;
183 } // namespace std
184 
185 #endif // _GLIBCXX_USE_C99
186 
187 #endif