Home | History | Annotate | Download | only in include
      1 /**
      2  * This file has no copyright assigned and is placed in the Public Domain.
      3  * This file is part of the mingw-w64 runtime package.
      4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
      5  */
      6 #ifndef _INC_STDIO
      7 #define _INC_STDIO
      8 
      9 #include <crtdefs.h>
     10 
     11 #include <_mingw_print_push.h>
     12 
     13 #pragma pack(push,_CRT_PACKING)
     14 
     15 #ifdef __cplusplus
     16 extern "C" {
     17 #endif
     18 
     19 #define BUFSIZ 512
     20 #define _NFILE _NSTREAM_
     21 #define _NSTREAM_ 512
     22 #define _IOB_ENTRIES 20
     23 #define EOF (-1)
     24 
     25 #ifndef _FILE_DEFINED
     26   struct _iobuf {
     27     char *_ptr;
     28     int _cnt;
     29     char *_base;
     30     int _flag;
     31     int _file;
     32     int _charbuf;
     33     int _bufsiz;
     34     char *_tmpfname;
     35   };
     36   typedef struct _iobuf FILE;
     37 #define _FILE_DEFINED
     38 #endif
     39 
     40 #ifdef _POSIX_
     41 #define _P_tmpdir "/"
     42 #define _wP_tmpdir L"/"
     43 #else
     44 #define _P_tmpdir "\\"
     45 #define _wP_tmpdir L"\\"
     46 #endif
     47 
     48 #define L_tmpnam (sizeof(_P_tmpdir) + 12)
     49 
     50 #ifdef _POSIX_
     51 #define L_ctermid 9
     52 #define L_cuserid 32
     53 #endif
     54 
     55 #define SEEK_CUR 1
     56 #define SEEK_END 2
     57 #define SEEK_SET 0
     58 
     59 #define	STDIN_FILENO	0
     60 #define	STDOUT_FILENO	1
     61 #define	STDERR_FILENO	2
     62 
     63 #define FILENAME_MAX 260
     64 #define FOPEN_MAX 20
     65 #define _SYS_OPEN 20
     66 #define TMP_MAX 32767
     67 
     68 #ifndef NULL
     69 #ifdef __cplusplus
     70 #ifndef _WIN64
     71 #define NULL 0
     72 #else
     73 #define NULL 0LL
     74 #endif  /* W64 */
     75 #else
     76 #define NULL ((void *)0)
     77 #endif
     78 #endif
     79 
     80 #include <_mingw_off_t.h>
     81 
     82 #ifndef _STDIO_DEFINED
     83 #ifdef _WIN64
     84   _CRTIMP FILE *__cdecl __iob_func(void);
     85 #define _iob  __iob_func()
     86 #else
     87 #ifdef _MSVCRT_
     88 extern FILE _iob[];	/* A pointer to an array of FILE */
     89 #define __iob_func()	(_iob)
     90 #else
     91 extern FILE (* __MINGW_IMP_SYMBOL(_iob))[];	/* A pointer to an array of FILE */
     92 #define __iob_func()	(* __MINGW_IMP_SYMBOL(_iob))
     93 #define _iob __iob_func()
     94 #endif
     95 #endif
     96 #endif
     97 
     98 #ifndef _FPOS_T_DEFINED
     99 #define _FPOS_T_DEFINED
    100 #undef _FPOSOFF
    101 
    102 #if (!defined(NO_OLDNAMES) || defined(__GNUC__))
    103   __MINGW_EXTENSION typedef __int64 fpos_t;
    104 #define _FPOSOFF(fp) ((long)(fp))
    105 #else
    106   __MINGW_EXTENSION typedef long long fpos_t;
    107 #define _FPOSOFF(fp) ((long)(fp))
    108 #endif
    109 
    110 #endif
    111 
    112 #ifndef _STDSTREAM_DEFINED
    113 #define _STDSTREAM_DEFINED
    114 
    115 #define stdin (&__iob_func()[0])
    116 #define stdout (&__iob_func()[1])
    117 #define stderr (&__iob_func()[2])
    118 #endif
    119 
    120 #define _IOREAD 0x0001
    121 #define _IOWRT 0x0002
    122 
    123 #define _IOFBF 0x0000
    124 #define _IOLBF 0x0040
    125 #define _IONBF 0x0004
    126 
    127 #define _IOMYBUF 0x0008
    128 #define _IOEOF 0x0010
    129 #define _IOERR 0x0020
    130 #define _IOSTRG 0x0040
    131 #define _IORW 0x0080
    132 #ifdef _POSIX_
    133 #define _IOAPPEND 0x0200
    134 #endif
    135 
    136 #define _TWO_DIGIT_EXPONENT 0x1
    137 
    138 #ifndef _STDIO_DEFINED
    139 extern
    140   __attribute__((__format__ (gnu_scanf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
    141   int __cdecl __mingw_sscanf(const char * __restrict__ _Src,const char * __restrict__ _Format,...);
    142 extern
    143   __attribute__((__format__ (gnu_scanf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
    144   int __cdecl __mingw_vsscanf (const char * __restrict__ _Str,const char * __restrict__ Format,va_list argp);
    145 extern
    146   __attribute__((__format__ (gnu_scanf, 1, 2))) __MINGW_ATTRIB_NONNULL(1)
    147   int __cdecl __mingw_scanf(const char * __restrict__ _Format,...);
    148 extern
    149   __attribute__((__format__ (gnu_scanf, 1, 0))) __MINGW_ATTRIB_NONNULL(1)
    150   int __cdecl __mingw_vscanf(const char * __restrict__ Format, va_list argp);
    151 extern
    152   __attribute__((__format__ (gnu_scanf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
    153   int __cdecl __mingw_fscanf(FILE * __restrict__ _File,const char * __restrict__ _Format,...);
    154 extern
    155   __attribute__((__format__ (gnu_scanf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
    156   int __cdecl __mingw_vfscanf (FILE * __restrict__ fp, const char * __restrict__ Format,va_list argp);
    157 
    158 extern
    159   __attribute__((__format__ (gnu_printf, 3, 0))) __MINGW_ATTRIB_NONNULL(3)
    160   int __cdecl __mingw_vsnprintf(char * __restrict__ _DstBuf,size_t _MaxCount,const char * __restrict__ _Format,
    161                                va_list _ArgList);
    162 extern
    163   __attribute__((__format__ (gnu_printf, 3, 4))) __MINGW_ATTRIB_NONNULL(3)
    164   int __cdecl __mingw_snprintf(char * __restrict__ s, size_t n, const char * __restrict__  format, ...);
    165 extern
    166   __attribute__((__format__ (gnu_printf, 1, 2))) __MINGW_ATTRIB_NONNULL(1)
    167   int __cdecl __mingw_printf(const char * __restrict__ , ... ) __MINGW_NOTHROW;
    168 extern
    169   __attribute__((__format__ (gnu_printf, 1, 0))) __MINGW_ATTRIB_NONNULL(1)
    170   int __cdecl __mingw_vprintf (const char * __restrict__ , va_list) __MINGW_NOTHROW;
    171 extern
    172   __attribute__((__format__ (gnu_printf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
    173   int __cdecl __mingw_fprintf (FILE * __restrict__ , const char * __restrict__ , ...) __MINGW_NOTHROW;
    174 extern
    175   __attribute__((__format__ (gnu_printf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
    176   int __cdecl __mingw_vfprintf (FILE * __restrict__ , const char * __restrict__ , va_list) __MINGW_NOTHROW;
    177 extern
    178   __attribute__((__format__ (gnu_printf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
    179   int __cdecl __mingw_sprintf (char * __restrict__ , const char * __restrict__ , ...) __MINGW_NOTHROW;
    180 extern
    181   __attribute__((__format__ (gnu_printf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
    182   int __cdecl __mingw_vsprintf (char * __restrict__ , const char * __restrict__ , va_list) __MINGW_NOTHROW;
    183 extern
    184   __attribute__((__format__ (gnu_printf, 2, 3))) __attribute__((nonnull (1,2)))
    185   int __cdecl __mingw_asprintf(char ** __restrict__ , const char * __restrict__ , ...) __MINGW_NOTHROW;
    186 extern
    187   __attribute__((__format__ (gnu_printf, 2, 0))) __attribute__((nonnull (1,2)))
    188   int __cdecl __mingw_vasprintf(char ** __restrict__ , const char * __restrict__ , va_list) __MINGW_NOTHROW;
    189 
    190 #if __USE_MINGW_ANSI_STDIO
    191 /*
    192  * User has expressed a preference for C99 conformance...
    193  */
    194 #undef __MINGW_PRINTF_FORMAT
    195 #undef __MINGW_SCANF_FORMAT
    196 #define __MINGW_PRINTF_FORMAT gnu_printf
    197 #define __MINGW_SCANF_FORMAT  gnu_scanf
    198 
    199 #ifdef _GNU_SOURCE
    200 __mingw_ovr
    201 __attribute__ ((__format__ (gnu_printf, 2, 3))) __attribute__((nonnull (1,2)))
    202 int asprintf(char **__ret, const char *__format, ...)
    203 {
    204   register int __retval;
    205   __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
    206   __retval = __mingw_vasprintf( __ret, __format, __local_argv );
    207   __builtin_va_end( __local_argv );
    208   return __retval;
    209 }
    210 
    211 __mingw_ovr
    212 __attribute__ ((__format__ (gnu_printf, 2, 0))) __attribute__((nonnull (1,2)))
    213 int vasprintf(char **__ret, const char *__format, __builtin_va_list __local_argv)
    214 {
    215   return __mingw_vasprintf( __ret, __format, __local_argv );
    216 }
    217 #endif /* _GNU_SOURCE */
    218 
    219 /* There seems to be a bug about builtins and static overrides of them
    220    in g++.  So we need to do here some trickery.  */
    221 #ifdef __cplusplus
    222 extern "C++" {
    223 #endif
    224 
    225 __mingw_ovr
    226 __attribute__((__format__ (gnu_scanf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
    227 int sscanf(const char *__source, const char *__format, ...)
    228 {
    229   register int __retval;
    230   __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
    231   __retval = __mingw_vsscanf( __source, __format, __local_argv );
    232   __builtin_va_end( __local_argv );
    233   return __retval;
    234 }
    235 
    236 __mingw_ovr
    237 __attribute__((__format__ (gnu_scanf, 1, 2))) __MINGW_ATTRIB_NONNULL(1)
    238 int scanf(const char *__format, ...)
    239 {
    240   register int __retval;
    241   __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
    242   __retval = __mingw_vscanf( __format, __local_argv );
    243   __builtin_va_end( __local_argv );
    244   return __retval;
    245 }
    246 
    247 __mingw_ovr
    248 __attribute__((__format__ (gnu_scanf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
    249 int fscanf(FILE *__stream, const char *__format, ...)
    250 {
    251   register int __retval;
    252   __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
    253   __retval = __mingw_vfscanf( __stream, __format, __local_argv );
    254   __builtin_va_end( __local_argv );
    255   return __retval;
    256 }
    257 
    258 #ifndef __NO_ISOCEXT  /* externs in libmingwex.a */
    259 __mingw_ovr
    260 __attribute__((__format__ (gnu_scanf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
    261 int vsscanf (const char *__source, const char *__format, __builtin_va_list __local_argv)
    262 {
    263   return __mingw_vsscanf( __source, __format, __local_argv );
    264 }
    265 
    266 __mingw_ovr
    267 __attribute__((__format__ (gnu_scanf, 1, 0))) __MINGW_ATTRIB_NONNULL(1)
    268 int vscanf(const char *__format,  __builtin_va_list __local_argv)
    269 {
    270   return __mingw_vscanf( __format, __local_argv );
    271 }
    272 
    273 __mingw_ovr
    274 __attribute__((__format__ (gnu_scanf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
    275 int vfscanf (FILE *__stream,  const char *__format, __builtin_va_list __local_argv)
    276 {
    277   return __mingw_vfscanf( __stream, __format, __local_argv );
    278 }
    279 #endif /* __NO_ISOCEXT */
    280 
    281 
    282 
    283 __mingw_ovr
    284 __attribute__((__format__ (gnu_printf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
    285 int fprintf (FILE *__stream, const char *__format, ...)
    286 {
    287   register int __retval;
    288   __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
    289   __retval = __mingw_vfprintf( __stream, __format, __local_argv );
    290   __builtin_va_end( __local_argv );
    291   return __retval;
    292 }
    293 
    294 __mingw_ovr
    295 __attribute__((__format__ (gnu_printf, 1, 2))) __MINGW_ATTRIB_NONNULL(1)
    296 int printf (const char *__format, ...)
    297 {
    298   register int __retval;
    299   __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
    300   __retval = __mingw_vprintf( __format, __local_argv );
    301   __builtin_va_end( __local_argv );
    302   return __retval;
    303 }
    304 
    305 __mingw_ovr
    306 __attribute__((__format__ (gnu_printf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
    307 int sprintf (char *__stream, const char *__format, ...)
    308 {
    309   register int __retval;
    310   __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
    311   __retval = __mingw_vsprintf( __stream, __format, __local_argv );
    312   __builtin_va_end( __local_argv );
    313   return __retval;
    314 }
    315 
    316 __mingw_ovr
    317 __attribute__((__format__ (gnu_printf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
    318 int vfprintf (FILE *__stream, const char *__format, __builtin_va_list __local_argv)
    319 {
    320   return __mingw_vfprintf( __stream, __format, __local_argv );
    321 }
    322 
    323 __mingw_ovr
    324 __attribute__((__format__ (gnu_printf, 1, 0))) __MINGW_ATTRIB_NONNULL(1)
    325 int vprintf (const char *__format, __builtin_va_list __local_argv)
    326 {
    327   return __mingw_vprintf( __format, __local_argv );
    328 }
    329 
    330 __mingw_ovr
    331 __attribute__((__format__ (gnu_printf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
    332 int vsprintf (char *__stream, const char *__format, __builtin_va_list __local_argv)
    333 {
    334   return __mingw_vsprintf( __stream, __format, __local_argv );
    335 }
    336 /* #ifndef __NO_ISOCEXT */  /* externs in libmingwex.a */
    337 __mingw_ovr
    338 __attribute__((__format__ (gnu_printf, 3, 4))) __MINGW_ATTRIB_NONNULL(3)
    339 int snprintf (char *__stream, size_t __n, const char *__format, ...)
    340 {
    341   register int __retval;
    342   __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
    343   __retval = __mingw_vsnprintf( __stream, __n, __format, __local_argv );
    344   __builtin_va_end( __local_argv );
    345   return __retval;
    346 }
    347 
    348 __mingw_ovr
    349 __attribute__((__format__ (gnu_printf, 3, 0))) __MINGW_ATTRIB_NONNULL(3)
    350 int vsnprintf (char *__stream, size_t __n, const char *__format, __builtin_va_list __local_argv)
    351 {
    352   return __mingw_vsnprintf( __stream, __n, __format, __local_argv );
    353 }
    354 
    355 /* Override __builtin_printf-routines ... Kludge for libstdc++ ...*/
    356 #define __builtin_vsnprintf __mingw_vsnprintf
    357 #define __builtin_vsprintf __mingw_vsprintf
    358 
    359 /* #endif */ /* __NO_ISOCEXT */
    360 
    361 #ifdef __cplusplus
    362 }
    363 #endif
    364 
    365 #else /* !__USE_MINGW_ANSI_STDIO */
    366 
    367 #undef __MINGW_PRINTF_FORMAT
    368 #undef __MINGW_SCANF_FORMAT
    369 #define __MINGW_PRINTF_FORMAT ms_printf
    370 #define __MINGW_SCANF_FORMAT  ms_scanf
    371 #undef __builtin_vsnprintf
    372 #undef __builtin_vsprintf
    373 
    374 /*
    375  * Default configuration: simply direct all calls to MSVCRT...
    376  */
    377   int __cdecl fprintf(FILE * __restrict__ _File,const char * __restrict__ _Format,...);
    378   int __cdecl printf(const char * __restrict__ _Format,...);
    379   int __cdecl sprintf(char * __restrict__ _Dest,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    380 
    381   int __cdecl vfprintf(FILE * __restrict__ _File,const char * __restrict__ _Format,va_list _ArgList);
    382   int __cdecl vprintf(const char * __restrict__ _Format,va_list _ArgList);
    383   int __cdecl vsprintf(char * __restrict__ _Dest,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    384 
    385   int __cdecl fscanf(FILE * __restrict__ _File,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    386   int __cdecl scanf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    387   int __cdecl sscanf(const char * __restrict__ _Src,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    388 #ifdef _GNU_SOURCE
    389   int __cdecl vasprintf(char ** __restrict__ ret,const char * __restrict__ format,va_list ap)  __attribute__ ((format (__MINGW_PRINTF_FORMAT, 2, 0)));;
    390   int __cdecl asprintf(char ** __restrict__ ret,const char * __restrict__ format,...) __attribute__ ((format (__MINGW_PRINTF_FORMAT, 2, 3)));
    391 #endif /*_GNU_SOURCE*/
    392 #ifndef __NO_ISOCEXT  /* externs in libmingwex.a */
    393   int __cdecl __ms_vscanf(const char * __restrict__ Format, va_list argp);
    394   int __cdecl __ms_vfscanf (FILE * __restrict__ fp, const char * __restrict__ Format,va_list argp);
    395   int __cdecl __ms_vsscanf (const char * __restrict__ _Str,const char * __restrict__ Format,va_list argp);
    396 
    397   __mingw_ovr
    398   __MINGW_ATTRIB_NONNULL(2)
    399   int vfscanf (FILE *__stream,  const char *__format, __builtin_va_list __local_argv)
    400   {
    401     return __ms_vfscanf (__stream, __format, __local_argv);
    402   }
    403 
    404   __mingw_ovr
    405   __MINGW_ATTRIB_NONNULL(2)
    406   int vsscanf (const char * __restrict__ __source, const char * __restrict__ __format, __builtin_va_list __local_argv)
    407   {
    408     return __ms_vsscanf( __source, __format, __local_argv );
    409   }
    410   __mingw_ovr
    411   __MINGW_ATTRIB_NONNULL(1)
    412   int vscanf(const char *__format,  __builtin_va_list __local_argv)
    413   {
    414     return __ms_vscanf (__format, __local_argv);
    415   }
    416 
    417 #endif /* __NO_ISOCEXT */
    418 #endif /* __USE_MINGW_ANSI_STDIO */
    419 
    420   _CRTIMP int __cdecl _filbuf(FILE *_File);
    421   _CRTIMP int __cdecl _flsbuf(int _Ch,FILE *_File);
    422 #ifdef _POSIX_
    423   _CRTIMP FILE *__cdecl _fsopen(const char *_Filename,const char *_Mode);
    424 #else
    425   _CRTIMP FILE *__cdecl _fsopen(const char *_Filename,const char *_Mode,int _ShFlag);
    426 #endif
    427   void __cdecl clearerr(FILE *_File);
    428   int __cdecl fclose(FILE *_File);
    429   _CRTIMP int __cdecl _fcloseall(void);
    430 #ifdef _POSIX_
    431   FILE *__cdecl fdopen(int _FileHandle,const char *_Mode) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    432 #else
    433   _CRTIMP FILE *__cdecl _fdopen(int _FileHandle,const char *_Mode);
    434 #endif
    435   int __cdecl feof(FILE *_File);
    436   int __cdecl ferror(FILE *_File);
    437   int __cdecl fflush(FILE *_File);
    438   int __cdecl fgetc(FILE *_File);
    439   _CRTIMP int __cdecl _fgetchar(void);
    440   int __cdecl fgetpos(FILE * __restrict__ _File ,fpos_t * __restrict__ _Pos); /* 64bit only, no 32bit version */
    441   int __cdecl fgetpos64(FILE * __restrict__ _File ,fpos_t * __restrict__ _Pos); /* fgetpos already 64bit */
    442   char *__cdecl fgets(char * __restrict__ _Buf,int _MaxCount,FILE * __restrict__ _File);
    443   _CRTIMP int __cdecl _fileno(FILE *_File);
    444 #ifdef _POSIX_
    445   int __cdecl fileno(FILE *_File) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    446 #endif
    447   _CRTIMP char *__cdecl _tempnam(const char *_DirName,const char *_FilePrefix);
    448   _CRTIMP int __cdecl _flushall(void);
    449   FILE *__cdecl fopen(const char * __restrict__ _Filename,const char * __restrict__ _Mode) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    450   FILE *fopen64(const char * __restrict__ filename,const char * __restrict__  mode);
    451   int __cdecl fputc(int _Ch,FILE *_File);
    452   _CRTIMP int __cdecl _fputchar(int _Ch);
    453   int __cdecl fputs(const char * __restrict__ _Str,FILE * __restrict__ _File);
    454   size_t __cdecl fread(void * __restrict__ _DstBuf,size_t _ElementSize,size_t _Count,FILE * __restrict__ _File);
    455   FILE *__cdecl freopen(const char * __restrict__ _Filename,const char * __restrict__ _Mode,FILE * __restrict__ _File) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    456   int __cdecl _fscanf_l(FILE * __restrict__ _File,const char * __restrict__ _Format,_locale_t locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    457   int __cdecl fsetpos(FILE *_File,const fpos_t *_Pos);
    458   int __cdecl fsetpos64(FILE *_File,const fpos_t *_Pos); /* fsetpos already 64bit */
    459   int __cdecl fseek(FILE *_File,long _Offset,int _Origin);
    460 
    461   /* Shouldn't be any fseeko32 in glibc, 32bit to 64bit casting should be fine */
    462   /* int fseeko32(FILE* stream, _off_t offset, int whence);*/ /* fseeko32 redirects to fseeko64 */
    463   int fseeko64(FILE* stream, _off64_t offset, int whence);
    464   int fseeko(FILE* stream, _off_t offset, int whence);
    465 
    466 #ifndef _FILE_OFFSET_BITS_SET_FSEEKO
    467 #define _FILE_OFFSET_BITS_SET_FSEEKO
    468 #if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64))
    469 #define fseeko fseeko64
    470 #endif /* (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) */
    471 #endif /* _FILE_OFFSET_BITS_SET_FSEEKO */
    472 
    473   long __cdecl ftell(FILE *_File);
    474   /* Returns truncated 64bit off_t */
    475   _off_t ftello(FILE * stream);
    476   _off64_t ftello64(FILE * stream);
    477 
    478 #ifndef _FILE_OFFSET_BITS_SET_FTELLO
    479 #define _FILE_OFFSET_BITS_SET_FTELLO
    480 #if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64))
    481 #define ftello ftello64
    482 #endif /* (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) */
    483 #endif /* _FILE_OFFSET_BITS_SET_FTELLO */
    484 
    485   __MINGW_EXTENSION int __cdecl _fseeki64(FILE *_File,__int64 _Offset,int _Origin);
    486   __MINGW_EXTENSION __int64 __cdecl _ftelli64(FILE *_File);
    487   size_t __cdecl fwrite(const void * __restrict__ _Str,size_t _Size,size_t _Count,FILE * __restrict__ _File);
    488   int __cdecl getc(FILE *_File);
    489   int __cdecl getchar(void);
    490   _CRTIMP int __cdecl _getmaxstdio(void);
    491   char *__cdecl gets(char *_Buffer) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    492   int __cdecl _getw(FILE *_File);
    493 #ifndef _CRT_PERROR_DEFINED
    494 #define _CRT_PERROR_DEFINED
    495   void __cdecl perror(const char *_ErrMsg);
    496 #endif
    497   _CRTIMP int __cdecl _pclose(FILE *_File);
    498   _CRTIMP FILE *__cdecl _popen(const char *_Command,const char *_Mode);
    499 #if !defined(NO_OLDNAMES) && !defined(popen)
    500 #define popen	_popen
    501 #define pclose	_pclose
    502 #endif
    503   int __cdecl putc(int _Ch,FILE *_File);
    504   int __cdecl putchar(int _Ch);
    505   int __cdecl puts(const char *_Str);
    506   _CRTIMP int __cdecl _putw(int _Word,FILE *_File);
    507 #ifndef _CRT_DIRECTORY_DEFINED
    508 #define _CRT_DIRECTORY_DEFINED
    509   int __cdecl remove(const char *_Filename);
    510   int __cdecl rename(const char *_OldFilename,const char *_NewFilename);
    511   _CRTIMP int __cdecl _unlink(const char *_Filename);
    512 #ifndef	NO_OLDNAMES
    513   int __cdecl unlink(const char *_Filename) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    514 #endif
    515 #endif
    516   void __cdecl rewind(FILE *_File);
    517   _CRTIMP int __cdecl _rmtmp(void);
    518   int __cdecl _scanf_l(const char * __restrict__ format,_locale_t locale,... ) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    519   void __cdecl setbuf(FILE * __restrict__ _File,char * __restrict__ _Buffer) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    520   _CRTIMP int __cdecl _setmaxstdio(int _Max);
    521   _CRTIMP unsigned int __cdecl _set_output_format(unsigned int _Format);
    522   _CRTIMP unsigned int __cdecl _get_output_format(void);
    523   unsigned int __cdecl __mingw_set_output_format(unsigned int _Format);
    524   unsigned int __cdecl __mingw_get_output_format(void);
    525 #if __USE_MINGW_OUTPUT_FORMAT_EMU == 1
    526 #define _set_output_format __mingw_set_output_format
    527 #define _get_output_format __mingw_get_output_format
    528 #endif
    529   int __cdecl setvbuf(FILE * __restrict__ _File,char * __restrict__ _Buf,int _Mode,size_t _Size);
    530   _CRTIMP int __cdecl _scprintf(const char * __restrict__ _Format,...);
    531   int __cdecl _sscanf_l(const char * __restrict__ buffer,const char * __restrict__ format,_locale_t locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    532   _CRTIMP int __cdecl _snscanf(const char * __restrict__ _Src,size_t _MaxCount,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    533   _CRTIMP int __cdecl _snscanf_l(const char * __restrict__ input,size_t length,const char * __restrict__ format,_locale_t locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    534   FILE *__cdecl tmpfile(void) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    535   char *__cdecl tmpnam(char *_Buffer);
    536   int __cdecl ungetc(int _Ch,FILE *_File);
    537 
    538   _CRTIMP int __cdecl _snprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    539   _CRTIMP int __cdecl _snprintf_l(char * __restrict__ buffer,size_t count,const char * __restrict__ format,_locale_t locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    540   _CRTIMP int __cdecl _vsnprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    541   _CRTIMP int __cdecl _vsnprintf_l(char * __restrict__ buffer,size_t count,const char * __restrict__ format,_locale_t locale,va_list argptr) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    542   int __cdecl _sprintf_l(char * __restrict__ buffer,const char * __restrict__ format,_locale_t locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    543 
    544 #if !defined (__USE_MINGW_ANSI_STDIO) || __USE_MINGW_ANSI_STDIO == 0
    545 /* this is here to deal with software defining
    546  * vsnprintf as _vsnprintf, eg. libxml2.  */
    547 #pragma push_macro("snprintf")
    548 #pragma push_macro("vsnprintf")
    549 # undef snprintf
    550 # undef vsnprintf
    551   int __cdecl __ms_vsnprintf(char * __restrict__ d,size_t n,const char * __restrict__ format,va_list arg)
    552     __MINGW_ATTRIB_DEPRECATED_MSVC2005 __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    553 
    554   __mingw_ovr
    555   __MINGW_ATTRIB_NONNULL(3)
    556   int vsnprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, va_list __local_argv)
    557   {
    558     return __ms_vsnprintf (__stream, __n, __format, __local_argv);
    559   }
    560 
    561   int __cdecl __ms_snprintf(char * __restrict__ s, size_t n, const char * __restrict__  format, ...);
    562 
    563 #ifndef __NO_ISOCEXT
    564 __mingw_ovr
    565 __MINGW_ATTRIB_NONNULL(3)
    566 int snprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, ...)
    567 {
    568   register int __retval;
    569   __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
    570   __retval = __ms_vsnprintf (__stream, __n, __format, __local_argv);
    571   __builtin_va_end( __local_argv );
    572   return __retval;
    573 }
    574 #endif /* !__NO_ISOCEXT */
    575 
    576 #pragma pop_macro ("vsnprintf")
    577 #pragma pop_macro ("snprintf")
    578 #endif
    579 
    580   _CRTIMP int __cdecl _vscprintf(const char * __restrict__ _Format,va_list _ArgList);
    581   _CRTIMP int __cdecl _set_printf_count_output(int _Value);
    582   _CRTIMP int __cdecl _get_printf_count_output(void);
    583 
    584 #ifndef _WSTDIO_DEFINED
    585 #define _WSTDIO_DEFINED
    586 
    587 /* __attribute__((__format__ (gnu_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2)
    588   int __cdecl __mingw_swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...);
    589 /* __attribute__((__format__ (gnu_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2)
    590   int __cdecl __mingw_vswscanf (const wchar_t * __restrict__ _Str,const wchar_t * __restrict__ Format,va_list argp);
    591 /* __attribute__((__format__ (gnu_wscanf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1)
    592   int __cdecl __mingw_wscanf(const wchar_t * __restrict__ _Format,...);
    593 /* __attribute__((__format__ (gnu_wscanf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1)
    594   int __cdecl __mingw_vwscanf(const wchar_t * __restrict__ Format, va_list argp);
    595 /* __attribute__((__format__ (gnu_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2)
    596   int __cdecl __mingw_fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...);
    597 /* __attribute__((__format__ (gnu_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2)
    598   int __cdecl __mingw_vfwscanf (FILE * __restrict__ fp, const wchar_t * __restrict__ Format,va_list argp);
    599 
    600 /* __attribute__((__format__ (gnu_wprintf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2)
    601   int __cdecl __mingw_fwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...);
    602 /* __attribute__((__format__ (gnu_wprintf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1)
    603   int __cdecl __mingw_wprintf(const wchar_t * __restrict__ _Format,...);
    604 /* __attribute__((__format__ (gnu_wprintf, 2, 0))) */__MINGW_ATTRIB_NONNULL(2)
    605   int __cdecl __mingw_vfwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list _ArgList);
    606 /*__attribute__((__format__ (gnu_wprintf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1)
    607   int __cdecl __mingw_vwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList);
    608 /* __attribute__((__format__ (gnu_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3)
    609   int __cdecl __mingw_snwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, ...);
    610 /* __attribute__((__format__ (gnu_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3)
    611   int __cdecl __mingw_vsnwprintf (wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , va_list);
    612 /* __attribute__((__format__ (gnu_wprintf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2)
    613   int __cdecl __mingw_swprintf(wchar_t * __restrict__ , const wchar_t * __restrict__ , ...);
    614 /* __attribute__((__format__ (gnu_wprintf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2)
    615   int __cdecl __mingw_vswprintf(wchar_t * __restrict__ , const wchar_t * __restrict__ ,va_list);
    616 
    617 #if __USE_MINGW_ANSI_STDIO
    618 /*
    619  * User has expressed a preference for C99 conformance...
    620  */
    621 
    622 __mingw_ovr
    623 /* __attribute__((__format__ (gnu_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2)
    624 int swscanf(const wchar_t *__source, const wchar_t *__format, ...)
    625 {
    626   register int __retval;
    627   __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
    628   __retval = __mingw_vswscanf( __source, __format, __local_argv );
    629   __builtin_va_end( __local_argv );
    630   return __retval;
    631 }
    632 
    633 __mingw_ovr
    634 /* __attribute__((__format__ (gnu_wscanf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1)
    635 int wscanf(const wchar_t *__format, ...)
    636 {
    637   register int __retval;
    638   __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
    639   __retval = __mingw_vwscanf( __format, __local_argv );
    640   __builtin_va_end( __local_argv );
    641   return __retval;
    642 }
    643 
    644 __mingw_ovr
    645 /* __attribute__((__format__ (gnu_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2)
    646 int fwscanf(FILE *__stream, const wchar_t *__format, ...)
    647 {
    648   register int __retval;
    649   __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
    650   __retval = __mingw_vfwscanf( __stream, __format, __local_argv );
    651   __builtin_va_end( __local_argv );
    652   return __retval;
    653 }
    654 
    655 #ifndef __NO_ISOCEXT  /* externs in libmingwex.a */
    656 __mingw_ovr
    657 /* __attribute__((__format__ (gnu_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2)
    658 int vswscanf (const wchar_t * __restrict__ __source, const wchar_t * __restrict__ __format, __builtin_va_list __local_argv)
    659 {
    660   return __mingw_vswscanf( __source, __format, __local_argv );
    661 }
    662 
    663 __mingw_ovr
    664 /* __attribute__((__format__ (gnu_wscanf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1)
    665 int vwscanf(const wchar_t *__format,  __builtin_va_list __local_argv)
    666 {
    667   return __mingw_vwscanf( __format, __local_argv );
    668 }
    669 
    670 __mingw_ovr
    671 /* __attribute__((__format__ (gnu_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2)
    672 int vfwscanf (FILE *__stream,  const wchar_t *__format, __builtin_va_list __local_argv)
    673 {
    674   return __mingw_vfwscanf( __stream, __format, __local_argv );
    675 }
    676 #endif /* __NO_ISOCEXT */
    677 
    678 
    679 
    680 __mingw_ovr
    681 /* __attribute__((__format__ (gnu_wprintf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2)
    682 int fwprintf (FILE *__stream, const wchar_t *__format, ...)
    683 {
    684   register int __retval;
    685   __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
    686   __retval = __mingw_vfwprintf( __stream, __format, __local_argv );
    687   __builtin_va_end( __local_argv );
    688   return __retval;
    689 }
    690 
    691 __mingw_ovr
    692 /* __attribute__((__format__ (gnu_wprintf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1)
    693 int wprintf (const wchar_t *__format, ...)
    694 {
    695   register int __retval;
    696   __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
    697   __retval = __mingw_vwprintf( __format, __local_argv );
    698   __builtin_va_end( __local_argv );
    699   return __retval;
    700 }
    701 
    702 __mingw_ovr
    703 /* __attribute__((__format__ (gnu_wprintf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2)
    704 int vfwprintf (FILE *__stream, const wchar_t *__format, __builtin_va_list __local_argv)
    705 {
    706   return __mingw_vfwprintf( __stream, __format, __local_argv );
    707 }
    708 
    709 __mingw_ovr
    710 /* __attribute__((__format__ (gnu_wprintf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1)
    711 int vwprintf (const wchar_t *__format, __builtin_va_list __local_argv)
    712 {
    713   return __mingw_vwprintf( __format, __local_argv );
    714 }
    715 
    716 #ifndef __NO_ISOCEXT  /* externs in libmingwex.a */
    717 __mingw_ovr
    718 /* __attribute__((__format__ (gnu_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3)
    719 int snwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, ...)
    720 {
    721   register int __retval;
    722   __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
    723   __retval = __mingw_vsnwprintf( __stream, __n, __format, __local_argv );
    724   __builtin_va_end( __local_argv );
    725   return __retval;
    726 }
    727 
    728 __mingw_ovr
    729 /* __attribute__((__format__ (gnu_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3)
    730 int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builtin_va_list __local_argv)
    731 {
    732   return __mingw_vsnwprintf( __stream, __n, __format, __local_argv );
    733 }
    734 #endif /* __NO_ISOCEXT */
    735 
    736 #else /* !__USE_MINGW_ANSI_STDIO */
    737 
    738   int __cdecl fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    739   int __cdecl swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    740   int __cdecl wscanf(const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    741 #ifndef __NO_ISOCEXT  /* externs in libmingwex.a */
    742   int __cdecl __ms_vwscanf (const wchar_t * __restrict__ , va_list);
    743   int __cdecl __ms_vfwscanf (FILE * __restrict__ ,const wchar_t * __restrict__ ,va_list);
    744   int __cdecl __ms_vswscanf (const wchar_t * __restrict__ ,const wchar_t * __restrict__ ,va_list);
    745 
    746   __mingw_ovr
    747   __MINGW_ATTRIB_NONNULL(2)
    748   int vfwscanf (FILE *__stream,  const wchar_t *__format, __builtin_va_list __local_argv)
    749   {
    750     return __ms_vfwscanf (__stream, __format, __local_argv);
    751   }
    752 
    753   __mingw_ovr
    754   __MINGW_ATTRIB_NONNULL(2)
    755   int vswscanf (const wchar_t * __restrict__ __source, const wchar_t * __restrict__ __format, __builtin_va_list __local_argv)
    756   {
    757     return __ms_vswscanf( __source, __format, __local_argv );
    758   }
    759   __mingw_ovr
    760   __MINGW_ATTRIB_NONNULL(1)
    761   int vwscanf(const wchar_t *__format,  __builtin_va_list __local_argv)
    762   {
    763     return __ms_vwscanf (__format, __local_argv);
    764   }
    765 
    766 #endif /* __NO_ISOCEXT */
    767 
    768   int __cdecl fwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...);
    769   int __cdecl wprintf(const wchar_t * __restrict__ _Format,...);
    770   int __cdecl vfwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list _ArgList);
    771   int __cdecl vwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList);
    772 #endif /* __USE_MINGW_ANSI_STDIO */
    773 
    774 #ifndef WEOF
    775 #define WEOF (wint_t)(0xFFFF)
    776 #endif
    777 
    778 #ifdef _POSIX_
    779   _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode);
    780 #else
    781   _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode,int _ShFlag);
    782 #endif
    783 
    784   wint_t __cdecl fgetwc(FILE *_File);
    785   _CRTIMP wint_t __cdecl _fgetwchar(void);
    786   wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File);
    787   _CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch);
    788   wint_t __cdecl getwc(FILE *_File);
    789   wint_t __cdecl getwchar(void);
    790   wint_t __cdecl putwc(wchar_t _Ch,FILE *_File);
    791   wint_t __cdecl putwchar(wchar_t _Ch);
    792   wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File);
    793   wchar_t *__cdecl fgetws(wchar_t * __restrict__ _Dst,int _SizeInWords,FILE * __restrict__ _File);
    794   int __cdecl fputws(const wchar_t * __restrict__ _Str,FILE * __restrict__ _File);
    795   _CRTIMP wchar_t *__cdecl _getws(wchar_t *_String) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    796   _CRTIMP int __cdecl _putws(const wchar_t *_Str);
    797 
    798   _CRTIMP int __cdecl _scwprintf(const wchar_t * __restrict__ _Format,...);
    799   _CRTIMP int __cdecl _swprintf_l(wchar_t * __restrict__ buffer,size_t count,const wchar_t * __restrict__ format,_locale_t locale,... ) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    800   _CRTIMP int __cdecl _swprintf_c(wchar_t * __restrict__ _DstBuf,size_t _SizeInWords,const wchar_t * __restrict__ _Format,...);
    801   _CRTIMP int __cdecl _vswprintf_c(wchar_t * __restrict__ _DstBuf,size_t _SizeInWords,const wchar_t * __restrict__ _Format,va_list _ArgList);
    802   _CRTIMP int __cdecl _snwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    803   _CRTIMP int __cdecl _vsnwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    804 
    805 #ifndef __NO_ISOCEXT  /* externs in libmingwex.a */
    806 
    807 #if !defined (__USE_MINGW_ANSI_STDIO) || __USE_MINGW_ANSI_STDIO == 0
    808 #pragma push_macro("snwprintf")
    809 #pragma push_macro("vsnwprintf")
    810 # undef snwprintf
    811 # undef vsnwprintf
    812   int __cdecl __ms_snwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, ...);
    813   int __cdecl __ms_vsnwprintf (wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , va_list);
    814   __mingw_ovr
    815   int snwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, ...)
    816   {
    817     int r;
    818     va_list argp;
    819     __builtin_va_start (argp, format);
    820     r = _vsnwprintf (s, n, format, argp);
    821     __builtin_va_end (argp);
    822     return r;
    823   }
    824   __mingw_ovr
    825   int __cdecl vsnwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, va_list arg)
    826   {
    827     return _vsnwprintf(s,n,format,arg);
    828   }
    829 #pragma pop_macro ("vsnwprintf")
    830 #pragma pop_macro ("snwprintf")
    831 #endif
    832 
    833 #endif /* ! __NO_ISOCEXT */
    834   _CRTIMP int __cdecl _fwprintf_p(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...);
    835   _CRTIMP int __cdecl _wprintf_p(const wchar_t * __restrict__ _Format,...);
    836   _CRTIMP int __cdecl _vfwprintf_p(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list _ArgList);
    837   _CRTIMP int __cdecl _vwprintf_p(const wchar_t * __restrict__ _Format,va_list _ArgList);
    838   _CRTIMP int __cdecl _swprintf_p(wchar_t * __restrict__ _DstBuf,size_t _MaxCount,const wchar_t * __restrict__ _Format,...);
    839   _CRTIMP int __cdecl _vswprintf_p(wchar_t * __restrict__ _DstBuf,size_t _MaxCount,const wchar_t * __restrict__ _Format,va_list _ArgList);
    840   _CRTIMP int __cdecl _scwprintf_p(const wchar_t * __restrict__ _Format,...);
    841   _CRTIMP int __cdecl _vscwprintf_p(const wchar_t * __restrict__ _Format,va_list _ArgList);
    842   _CRTIMP int __cdecl _wprintf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...);
    843   _CRTIMP int __cdecl _wprintf_p_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...);
    844   _CRTIMP int __cdecl _vwprintf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
    845   _CRTIMP int __cdecl _vwprintf_p_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
    846   _CRTIMP int __cdecl _fwprintf_l(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,_locale_t _Locale,...);
    847   _CRTIMP int __cdecl _fwprintf_p_l(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,_locale_t _Locale,...);
    848   _CRTIMP int __cdecl _vfwprintf_l(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
    849   _CRTIMP int __cdecl _vfwprintf_p_l(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
    850   _CRTIMP int __cdecl _swprintf_c_l(wchar_t * __restrict__ _DstBuf,size_t _MaxCount,const wchar_t * __restrict__ _Format,_locale_t _Locale,...);
    851   _CRTIMP int __cdecl _swprintf_p_l(wchar_t * __restrict__ _DstBuf,size_t _MaxCount,const wchar_t * __restrict__ _Format,_locale_t _Locale,...);
    852   _CRTIMP int __cdecl _vswprintf_c_l(wchar_t * __restrict__ _DstBuf,size_t _MaxCount,const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
    853   _CRTIMP int __cdecl _vswprintf_p_l(wchar_t * __restrict__ _DstBuf,size_t _MaxCount,const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
    854   _CRTIMP int __cdecl _scwprintf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...);
    855   _CRTIMP int __cdecl _scwprintf_p_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...);
    856   _CRTIMP int __cdecl _vscwprintf_p_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
    857   _CRTIMP int __cdecl _snwprintf_l(wchar_t * __restrict__ _DstBuf,size_t _MaxCount,const wchar_t * __restrict__ _Format,_locale_t _Locale,...);
    858   _CRTIMP int __cdecl _vsnwprintf_l(wchar_t * __restrict__ _DstBuf,size_t _MaxCount,const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    859   _CRTIMP int __cdecl _swprintf(wchar_t * __restrict__ _Dest,const wchar_t * __restrict__ _Format,...);
    860   _CRTIMP int __cdecl _vswprintf(wchar_t * __restrict__ _Dest,const wchar_t * __restrict__ _Format,va_list _Args);
    861   _CRTIMP int __cdecl __swprintf_l(wchar_t * __restrict__ _Dest,const wchar_t * __restrict__ _Format,_locale_t _Plocinfo,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    862   _CRTIMP int __cdecl _vswprintf_l(wchar_t * __restrict__ buffer,size_t count,const wchar_t * __restrict__ format,_locale_t locale,va_list argptr) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    863   _CRTIMP int __cdecl __vswprintf_l(wchar_t * __restrict__ _Dest,const wchar_t * __restrict__ _Format,_locale_t _Plocinfo,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    864 
    865 #ifndef RC_INVOKED
    866 #include <swprintf.inl>
    867 #endif
    868 
    869 #ifdef _CRT_NON_CONFORMING_SWPRINTFS
    870 #ifndef __cplusplus
    871 #define _swprintf_l __swprintf_l
    872 #define _vswprintf_l __vswprintf_l
    873 #endif
    874 #endif
    875 
    876   _CRTIMP wchar_t *__cdecl _wtempnam(const wchar_t *_Directory,const wchar_t *_FilePrefix);
    877   _CRTIMP int __cdecl _vscwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList);
    878   _CRTIMP int __cdecl _vscwprintf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
    879   _CRTIMP int __cdecl _fwscanf_l(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,_locale_t _Locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    880   _CRTIMP int __cdecl _swscanf_l(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,_locale_t _Locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    881   _CRTIMP int __cdecl _snwscanf(const wchar_t * __restrict__ _Src,size_t _MaxCount,const wchar_t * __restrict__ _Format,...);
    882   _CRTIMP int __cdecl _snwscanf_l(const wchar_t * __restrict__ _Src,size_t _MaxCount,const wchar_t * __restrict__ _Format,_locale_t _Locale,...);
    883   _CRTIMP int __cdecl _wscanf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    884   _CRTIMP FILE *__cdecl _wfdopen(int _FileHandle ,const wchar_t *_Mode);
    885   _CRTIMP FILE *__cdecl _wfopen(const wchar_t * __restrict__ _Filename,const wchar_t *__restrict__  _Mode) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    886   _CRTIMP FILE *__cdecl _wfreopen(const wchar_t * __restrict__ _Filename,const wchar_t * __restrict__ _Mode,FILE * __restrict__ _OldFile) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
    887 
    888 #ifndef _CRT_WPERROR_DEFINED
    889 #define _CRT_WPERROR_DEFINED
    890   _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg);
    891 #endif
    892   _CRTIMP FILE *__cdecl _wpopen(const wchar_t *_Command,const wchar_t *_Mode);
    893 #if !defined(NO_OLDNAMES) && !defined(wpopen)
    894 #define wpopen	_wpopen
    895 #endif
    896 
    897   _CRTIMP int __cdecl _wremove(const wchar_t *_Filename);
    898   _CRTIMP wchar_t *__cdecl _wtmpnam(wchar_t *_Buffer);
    899   _CRTIMP wint_t __cdecl _fgetwc_nolock(FILE *_File);
    900   _CRTIMP wint_t __cdecl _fputwc_nolock(wchar_t _Ch,FILE *_File);
    901   _CRTIMP wint_t __cdecl _ungetwc_nolock(wint_t _Ch,FILE *_File);
    902 
    903 #undef _CRT_GETPUTWCHAR_NOINLINE
    904 
    905 #if !defined(__cplusplus) || defined(_CRT_GETPUTWCHAR_NOINLINE) || defined (__CRT__NO_INLINE)
    906 #define getwchar() fgetwc(stdin)
    907 #define putwchar(_c) fputwc((_c),stdout)
    908 #else
    909   __CRT_INLINE wint_t __cdecl getwchar() {return (fgetwc(stdin)); }
    910   __CRT_INLINE wint_t __cdecl putwchar(wchar_t _C) {return (fputwc(_C,stdout)); }
    911 #endif
    912 
    913 #define getwc(_stm) fgetwc(_stm)
    914 #define putwc(_c,_stm) fputwc(_c,_stm)
    915 #define _putwc_nolock(_c,_stm) _fputwc_nolock(_c,_stm)
    916 #define _getwc_nolock(_c) _fgetwc_nolock(_c)
    917 #endif
    918 
    919 #define _STDIO_DEFINED
    920 #endif
    921 
    922 #define _fgetc_nolock(_stream) (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ : _filbuf(_stream))
    923 #define _fputc_nolock(_c,_stream) (--(_stream)->_cnt >= 0 ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream)))
    924 #define _getc_nolock(_stream) _fgetc_nolock(_stream)
    925 #define _putc_nolock(_c,_stream) _fputc_nolock(_c,_stream)
    926 #define _getchar_nolock() _getc_nolock(stdin)
    927 #define _putchar_nolock(_c) _putc_nolock((_c),stdout)
    928 #define _getwchar_nolock() _getwc_nolock(stdin)
    929 #define _putwchar_nolock(_c) _putwc_nolock((_c),stdout)
    930 
    931   _CRTIMP void __cdecl _lock_file(FILE *_File);
    932   _CRTIMP void __cdecl _unlock_file(FILE *_File);
    933   _CRTIMP int __cdecl _fclose_nolock(FILE *_File);
    934   _CRTIMP int __cdecl _fflush_nolock(FILE *_File);
    935   _CRTIMP size_t __cdecl _fread_nolock(void * __restrict__ _DstBuf,size_t _ElementSize,size_t _Count,FILE * __restrict__ _File);
    936   _CRTIMP int __cdecl _fseek_nolock(FILE *_File,long _Offset,int _Origin);
    937   _CRTIMP long __cdecl _ftell_nolock(FILE *_File);
    938   __MINGW_EXTENSION _CRTIMP int __cdecl _fseeki64_nolock(FILE *_File,__int64 _Offset,int _Origin);
    939   __MINGW_EXTENSION _CRTIMP __int64 __cdecl _ftelli64_nolock(FILE *_File);
    940   _CRTIMP size_t __cdecl _fwrite_nolock(const void * __restrict__ _DstBuf,size_t _Size,size_t _Count,FILE * __restrict__ _File);
    941   _CRTIMP int __cdecl _ungetc_nolock(int _Ch,FILE *_File);
    942 
    943 #if !defined(NO_OLDNAMES) || !defined(_POSIX)
    944 #define P_tmpdir _P_tmpdir
    945 #define SYS_OPEN _SYS_OPEN
    946 
    947   char *__cdecl tempnam(const char *_Directory,const char *_FilePrefix) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    948   int __cdecl fcloseall(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    949   FILE *__cdecl fdopen(int _FileHandle,const char *_Format) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    950   int __cdecl fgetchar(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    951   int __cdecl fileno(FILE *_File) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    952   int __cdecl flushall(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    953   int __cdecl fputchar(int _Ch) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    954   int __cdecl getw(FILE *_File) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    955   int __cdecl putw(int _Ch,FILE *_File) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    956   int __cdecl rmtmp(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    957 #endif
    958 
    959 #ifndef __MINGW_MBWC_CONVERT_DEFINED
    960 #define __MINGW_MBWC_CONVERT_DEFINED
    961 
    962 /**
    963  * __mingw_str_wide_utf8
    964  * Converts a null terminated UCS-2 string to a multibyte (UTF-8) equivalent.
    965  * Caller is supposed to free allocated buffer with __mingw_str_free().
    966  * @param[in] wptr Pointer to wide string.
    967  * @param[out] mbptr Pointer to multibyte string.
    968  * @param[out] buflen Optional parameter for length of allocated buffer.
    969  * @return Number of characters converted, 0 for failure.
    970  *
    971  * WideCharToMultiByte - http://msdn.microsoft.com/en-us/library/dd374130(VS.85).aspx
    972  */
    973 int __cdecl __mingw_str_wide_utf8 (const wchar_t * const wptr, char **mbptr, size_t * buflen);
    974 
    975 /**
    976  * __mingw_str_utf8_wide
    977  * Converts a null terminated UTF-8 string to a UCS-2 equivalent.
    978  * Caller is supposed to free allocated buffer with __mingw_str_free().
    979  * @param[out] mbptr Pointer to multibyte string.
    980  * @param[in] wptr Pointer to wide string.
    981  * @param[out] buflen Optional parameter for length of allocated buffer.
    982  * @return Number of characters converted, 0 for failure.
    983  *
    984  * MultiByteToWideChar - http://msdn.microsoft.com/en-us/library/dd319072(VS.85).aspx
    985  */
    986 
    987 int __cdecl __mingw_str_utf8_wide (const char *const mbptr, wchar_t ** wptr, size_t * buflen);
    988 
    989 /**
    990  * __mingw_str_free
    991  * Frees buffer create by __mingw_str_wide_utf8 and __mingw_str_utf8_wide.
    992  * @param[in] ptr memory block to free.
    993  *
    994  */
    995 
    996 void __cdecl __mingw_str_free(void *ptr);
    997 
    998 #endif /* __MINGW_MBWC_CONVERT_DEFINED */
    999 
   1000 #ifdef __cplusplus
   1001 }
   1002 #endif
   1003 
   1004 #pragma pack(pop)
   1005 
   1006 #include <sec_api/stdio_s.h>
   1007 
   1008 #include <_mingw_print_pop.h>
   1009 
   1010 #endif
   1011