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