libstdc++
cstdio
Go to the documentation of this file.
00001 // -*- C++ -*- forwarding header.
00002 
00003 // Copyright (C) 1997-2015 Free Software Foundation, Inc.
00004 //
00005 // This file is part of the GNU ISO C++ Library.  This library is free
00006 // software; you can redistribute it and/or modify it under the
00007 // terms of the GNU General Public License as published by the
00008 // Free Software Foundation; either version 3, or (at your option)
00009 // any later version.
00010 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 
00016 // Under Section 7 of GPL version 3, you are granted additional
00017 // permissions described in the GCC Runtime Library Exception, version
00018 // 3.1, as published by the Free Software Foundation.
00019 
00020 // You should have received a copy of the GNU General Public License and
00021 // a copy of the GCC Runtime Library Exception along with this program;
00022 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
00023 // <http://www.gnu.org/licenses/>.
00024 
00025 /** @file include/cstdio
00026  *  This is a Standard C++ Library file.  You should @c \#include this file
00027  *  in your programs, rather than any of the @a *.h implementation files.
00028  *
00029  *  This is the C++ version of the Standard C Library header @c stdio.h,
00030  *  and its contents are (mostly) the same as that header, but are all
00031  *  contained in the namespace @c std (except for names which are defined
00032  *  as macros in C).
00033  */
00034 
00035 //
00036 // ISO C++ 14882: 27.8.2  C Library files
00037 //
00038 
00039 #pragma GCC system_header
00040 
00041 #include <bits/c++config.h>
00042 #include <stdio.h>
00043 
00044 #ifndef _GLIBCXX_CSTDIO
00045 #define _GLIBCXX_CSTDIO 1
00046 
00047 #ifndef _GLIBCXX_HAVE_GETS
00048 extern "C" char* gets (char* __s) __attribute__((__deprecated__));
00049 #endif
00050 
00051 // Get rid of those macros defined in <stdio.h> in lieu of real functions.
00052 #undef clearerr
00053 #undef fclose
00054 #undef feof
00055 #undef ferror
00056 #undef fflush
00057 #undef fgetc
00058 #undef fgetpos
00059 #undef fgets
00060 #undef fopen
00061 #undef fprintf
00062 #undef fputc
00063 #undef fputs
00064 #undef fread
00065 #undef freopen
00066 #undef fscanf
00067 #undef fseek
00068 #undef fsetpos
00069 #undef ftell
00070 #undef fwrite
00071 #undef getc
00072 #undef getchar
00073 #if __cplusplus <= 201103L
00074 # undef gets
00075 #endif
00076 #undef perror
00077 #undef printf
00078 #undef putc
00079 #undef putchar
00080 #undef puts
00081 #undef remove
00082 #undef rename
00083 #undef rewind
00084 #undef scanf
00085 #undef setbuf
00086 #undef setvbuf
00087 #undef sprintf
00088 #undef sscanf
00089 #undef tmpfile
00090 #undef tmpnam
00091 #undef ungetc
00092 #undef vfprintf
00093 #undef vprintf
00094 #undef vsprintf
00095 
00096 namespace std
00097 {
00098   using ::FILE;
00099   using ::fpos_t;
00100 
00101   using ::clearerr;
00102   using ::fclose;
00103   using ::feof;
00104   using ::ferror;
00105   using ::fflush;
00106   using ::fgetc;
00107   using ::fgetpos;
00108   using ::fgets;
00109   using ::fopen;
00110   using ::fprintf;
00111   using ::fputc;
00112   using ::fputs;
00113   using ::fread;
00114   using ::freopen;
00115   using ::fscanf;
00116   using ::fseek;
00117   using ::fsetpos;
00118   using ::ftell;
00119   using ::fwrite;
00120   using ::getc;
00121   using ::getchar;
00122 #if __cplusplus <= 201103L
00123   // LWG 2249
00124   using ::gets;
00125 #endif
00126   using ::perror;
00127   using ::printf;
00128   using ::putc;
00129   using ::putchar;
00130   using ::puts;
00131   using ::remove;
00132   using ::rename;
00133   using ::rewind;
00134   using ::scanf;
00135   using ::setbuf;
00136   using ::setvbuf;
00137   using ::sprintf;
00138   using ::sscanf;
00139   using ::tmpfile;
00140 #if _GLIBCXX_USE_TMPNAM
00141   using ::tmpnam;
00142 #endif
00143   using ::ungetc;
00144   using ::vfprintf;
00145   using ::vprintf;
00146   using ::vsprintf;
00147 } // namespace
00148 
00149 #if _GLIBCXX_USE_C99
00150 
00151 #undef snprintf
00152 #undef vfscanf
00153 #undef vscanf
00154 #undef vsnprintf
00155 #undef vsscanf
00156 
00157 namespace __gnu_cxx
00158 {
00159 #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
00160   extern "C" int
00161   (snprintf)(char * __restrict, std::size_t, const char * __restrict, ...)
00162   throw ();
00163   extern "C" int
00164   (vfscanf)(FILE * __restrict, const char * __restrict, __gnuc_va_list);
00165   extern "C" int (vscanf)(const char * __restrict, __gnuc_va_list);
00166   extern "C" int
00167   (vsnprintf)(char * __restrict, std::size_t, const char * __restrict,
00168               __gnuc_va_list) throw ();
00169   extern "C" int
00170   (vsscanf)(const char * __restrict, const char * __restrict, __gnuc_va_list)
00171   throw ();
00172 #endif
00173 
00174 #if !_GLIBCXX_USE_C99_DYNAMIC
00175   using ::snprintf;
00176   using ::vfscanf;
00177   using ::vscanf;
00178   using ::vsnprintf;
00179   using ::vsscanf;
00180 #endif
00181 } // namespace __gnu_cxx
00182 
00183 namespace std
00184 {
00185   using ::__gnu_cxx::snprintf;
00186   using ::__gnu_cxx::vfscanf;
00187   using ::__gnu_cxx::vscanf;
00188   using ::__gnu_cxx::vsnprintf;
00189   using ::__gnu_cxx::vsscanf;
00190 } // namespace std
00191 
00192 #endif // _GLIBCXX_USE_C99
00193 
00194 #endif