2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER within this package.
11 #define __need___va_list
14 #pragma pack(push,_CRT_PACKING)
21 #define _NFILE _NSTREAM_
23 #define _IOB_ENTRIES 20
37 typedef struct _iobuf
FILE;
43 #define _wP_tmpdir L"/"
45 #define _P_tmpdir "\\"
46 #define _wP_tmpdir L"\\"
49 #define L_tmpnam (sizeof(_P_tmpdir) + 12)
60 #define STDIN_FILENO 0
61 #define STDOUT_FILENO 1
62 #define STDERR_FILENO 2
64 #define FILENAME_MAX 260
73 #define NULL ((void *)0)
77 #ifndef _OFF_T_DEFINED
78 #define _OFF_T_DEFINED
82 #if !defined(NO_OLDNAMES) || defined(_POSIX)
88 #ifndef _OFF64_T_DEFINED
89 #define _OFF64_T_DEFINED
90 __MINGW_EXTENSION
typedef long long _off64_t
;
91 #if !defined(NO_OLDNAMES) || defined(_POSIX)
92 __MINGW_EXTENSION
typedef long long off64_t
;
96 #ifndef _STDIO_DEFINED
97 _CRTIMP
FILE *__cdecl
__iob_func(void);
98 _CRTDATA(extern FILE _iob
[];)
100 #define _iob __iob_func()
104 #ifndef _STDSTREAM_DEFINED
105 #define _STDSTREAM_DEFINED
106 #define stdin (&_iob[0])
107 #define stdout (&_iob[1])
108 #define stderr (&_iob[2])
109 #endif /* !_STDSTREAM_DEFINED */
111 #ifndef _FPOS_T_DEFINED
112 #define _FPOS_T_DEFINED
115 #if (!defined(NO_OLDNAMES) || defined(__GNUC__)) && _INTEGRAL_MAX_BITS >= 64
116 __MINGW_EXTENSION
typedef __int64
fpos_t;
117 #define _FPOSOFF(fp) ((long)(fp))
119 __MINGW_EXTENSION
typedef long long fpos_t;
120 #define _FPOSOFF(fp) ((long)(fp))
125 #define _IOREAD 0x0001
126 #define _IOWRT 0x0002
128 #define _IOFBF 0x0000
129 #define _IOLBF 0x0040
130 #define _IONBF 0x0004
132 #define _IOMYBUF 0x0008
133 #define _IOEOF 0x0010
134 #define _IOERR 0x0020
135 #define _IOSTRG 0x0040
137 #define _USERBUF 0x0100
139 #define _TWO_DIGIT_EXPONENT 0x1
141 #ifndef _STDIO_DEFINED
148 _Inout_
FILE *_File
);
156 _Inout_
FILE *_File
);
163 const char *_Filename
,
171 _In_z_
const char *_Filename
,
172 _In_z_
const char *_Mode
,
180 _Inout_
FILE *_File
);
187 _Inout_
FILE *_File
);
207 _In_
int _FileHandle
,
208 _In_z_
const char *_Mode
);
230 _Inout_opt_
FILE *_File
);
237 _Inout_
FILE *_File
);
258 _Out_writes_z_(_MaxCount
) char *_Buf
,
260 _Inout_
FILE *_File
);
281 _In_opt_z_
const char *_DirName
,
282 _In_opt_z_
const char *_FilePrefix
);
295 _In_z_
const char *_Filename
,
296 _In_z_
const char *_Mode
);
304 _In_z_ _Printf_format_string_
const char *_Format
,
313 _Inout_
FILE *_File
);
327 _In_z_
const char *_Str
,
328 _Inout_
FILE *_File
);
335 _Out_writes_bytes_(_ElementSize
* _Count
) void *_DstBuf
,
336 _In_
size_t _ElementSize
,
338 _Inout_
FILE *_File
);
342 _CRT_INSECURE_DEPRECATE(freopen_s
)
346 _In_z_
const char *_Filename
,
347 _In_z_
const char *_Mode
,
348 _Inout_
FILE *_File
);
352 _CRT_INSECURE_DEPRECATE(fscanf_s
)
357 _In_z_ _Scanf_format_string_
const char *_Format
,
366 _In_
const fpos_t *_Pos
);
382 _Inout_
FILE *_File
);
391 _In_ __int64 _Offset
,
400 _Inout_
FILE *_File
);
407 _In_reads_bytes_(_Size
* _Count
) const void *_Str
,
410 _Inout_
FILE *_File
);
417 _Inout_
FILE *_File
);
435 char *_Buffer
); // FIXME: non-standard
442 _Inout_
FILE *_File
);
444 #ifndef _CRT_PERROR_DEFINED
445 #define _CRT_PERROR_DEFINED
450 _In_opt_z_
const char *_ErrMsg
);
458 _Inout_
FILE *_File
);
465 _In_z_
const char *_Command
,
466 _In_z_
const char *_Mode
);
473 _In_z_ _Printf_format_string_
const char *_Format
,
482 _Inout_
FILE *_File
);
496 _In_z_
const char *_Str
);
504 _Inout_
FILE *_File
);
506 #ifndef _CRT_DIRECTORY_DEFINED
507 #define _CRT_DIRECTORY_DEFINED
514 _In_z_
const char *_Filename
);
521 _In_z_
const char *_OldFilename
,
522 _In_z_
const char *_NewFilename
);
529 _In_z_
const char *_Filename
);
534 _CRT_NONSTDC_DEPRECATE(_unlink
)
538 _In_z_
const char *_Filename
);
541 #endif /* _CRT_DIRECTORY_DEFINED */
547 _Inout_
FILE *_File
);
557 _CRT_INSECURE_DEPRECATE_CORE(scanf_s
)
561 _In_z_ _Scanf_format_string_
const char *_Format
,
565 _CRT_INSECURE_DEPRECATE(setvbuf
)
570 _Inout_updates_opt_(BUFSIZ
) _Post_readable_size_(0) char *_Buffer
);
584 _In_
unsigned int _Format
);
590 _get_output_format(void);
598 _Inout_updates_opt_z_(_Size
) char *_Buf
,
607 _In_z_ _Printf_format_string_
const char *_Format
,
612 _CRT_INSECURE_DEPRECATE_CORE(sscanf_s
)
616 _In_z_
const char *_Src
,
617 _In_z_ _Scanf_format_string_
const char *_Format
,
622 _CRT_INSECURE_DEPRECATE_CORE(_snscanf_s
)
626 _In_reads_bytes_(_MaxCount
) _Pre_z_
const char *_Src
,
627 _In_
size_t _MaxCount
,
628 _In_z_ _Scanf_format_string_
const char *_Format
,
633 _CRT_INSECURE_DEPRECATE(tmpfile_s
)
642 _Pre_maybenull_ _Post_z_
char *_Buffer
);
650 _Inout_
FILE *_File
);
658 _In_z_ _Printf_format_string_
const char *_Format
,
666 _In_z_ _Printf_format_string_
const char *_Format
,
669 /* Make sure macros are not defined. */
670 #if __MINGW_GNUC_PREREQ(4,4)
671 #pragma push_macro("vsnprintf")
672 #pragma push_macro("snprintf")
679 _CRT_INSECURE_DEPRECATE(vsnprintf_s
)
683 _Out_writes_(_MaxCount
) char *_DstBuf
,
684 _In_
size_t _MaxCount
,
685 _In_z_ _Printf_format_string_
const char *_Format
,
688 _CRTIMP
int __cdecl
_snprintf(char *_Dest
,size_t _Count
,const char *_Format
,...);
689 _CRTIMP
int __cdecl
_vsnprintf(char *_Dest
,size_t _Count
,const char *_Format
,va_list _Args
);
690 int __cdecl
sprintf(char *_Dest
,const char *_Format
,...);
691 int __cdecl
vsprintf(char *_Dest
,const char *_Format
,va_list _Args
);
693 #ifndef __NO_ISOCEXT /* externs in libmingwex.a */
694 int __cdecl
snprintf(char* s
, size_t n
, const char* format
, ...);
695 int __cdecl
vscanf(const char * __restrict__ Format
, va_list argp
);
696 int __cdecl
vfscanf (FILE * __restrict__ fp
, const char * Format
,va_list argp
);
697 int __cdecl
vsscanf (const char * __restrict__ _Str
,const char * __restrict__ Format
,va_list argp
);
700 /* Restore may prior defined macros snprintf/vsnprintf. */
701 #if __MINGW_GNUC_PREREQ(4,4)
702 #pragma pop_macro("snprintf")
703 #pragma pop_macro("vsnprintf")
707 #define vsnprintf _vsnprintf
710 #define snprintf _snprintf
718 _In_z_ _Printf_format_string_
const char *_Format
,
722 #define _set_printf_count_output(i)
723 #define _get_printf_count_output() (FALSE)
725 _CRTIMP
int __cdecl
_set_printf_count_output(_In_
int _Value
);
726 _CRTIMP
int __cdecl
_get_printf_count_output(void);
729 #ifndef _WSTDIO_DEFINED
732 #define WEOF (wint_t)(0xFFFF)
740 const wchar_t *_Filename
,
741 const wchar_t *_Mode
);
748 _In_z_
const wchar_t *_Filename
,
749 _In_z_
const wchar_t *_Mode
,
758 _Inout_
FILE *_File
);
772 _Inout_
FILE *_File
);
786 _Inout_
FILE *_File
);
800 _Inout_
FILE *_File
);
815 _Inout_
FILE *_File
);
822 _Out_writes_z_(_SizeInWords
) wchar_t *_Dst
,
823 _In_
int _SizeInWords
,
824 _Inout_
FILE *_File
);
831 _In_z_
const wchar_t *_Str
,
832 _Inout_
FILE *_File
);
845 _In_z_
const wchar_t *_Str
);
853 _In_z_ _Printf_format_string_
const wchar_t *_Format
,
861 _In_z_ _Printf_format_string_
const wchar_t *_Format
,
869 _In_z_ _Printf_format_string_
const wchar_t *_Format
,
878 _In_z_ _Printf_format_string_
const wchar_t *_Format
,
886 _In_z_ _Printf_format_string_
const wchar_t *_Format
,
895 _Printf_format_string_
const wchar_t*,
911 _Out_writes_z_(_SizeInWords
) wchar_t *_DstBuf
,
912 _In_
size_t _SizeInWords
,
913 _In_z_ _Printf_format_string_
const wchar_t *_Format
,
921 _Out_writes_z_(_SizeInWords
) wchar_t *_DstBuf
,
922 _In_
size_t _SizeInWords
,
923 _In_z_ _Printf_format_string_
const wchar_t *_Format
,
926 _CRTIMP
int __cdecl
_snwprintf(wchar_t *_Dest
,size_t _Count
,const wchar_t *_Format
,...);
927 _CRTIMP
int __cdecl
_vsnwprintf(wchar_t *_Dest
,size_t _Count
,const wchar_t *_Format
,va_list _Args
);
928 #ifndef __NO_ISOCEXT /* externs in libmingwex.a */
929 _CRTIMP
int __cdecl
snwprintf (wchar_t* s
, size_t n
, const wchar_t* format
, ...);
930 __CRT_INLINE
int __cdecl
vsnwprintf (wchar_t* s
, size_t n
, const wchar_t* format
, va_list arg
)
933 #pragma warning(push)
934 #pragma warning(disable:28719) /* disable banned api usage warning */
935 #endif /* _MSC_VER */
936 return _vsnwprintf(s
,n
,format
,arg
);
939 #endif /* _MSC_VER */
941 _CRTIMP
int __cdecl
vwscanf (const wchar_t *, va_list);
942 _CRTIMP
int __cdecl
vfwscanf (FILE *,const wchar_t *,va_list);
943 _CRTIMP
int __cdecl
vswscanf (const wchar_t *,const wchar_t *,va_list);
945 _CRTIMP
int __cdecl
_swprintf(wchar_t *_Dest
,const wchar_t *_Format
,...);
946 _CRTIMP
int __cdecl
_vswprintf(wchar_t *_Dest
,const wchar_t *_Format
,va_list _Args
);
952 #if 0 //this is for MSVCRT80 and higher, which we don't use nor implement
953 #ifdef _CRT_NON_CONFORMING_SWPRINTFS
955 #define swprintf _swprintf
956 #define vswprintf _vswprintf
957 #define _swprintf_l __swprintf_l
958 #define _vswprintf_l __vswprintf_l
968 _In_opt_z_
const wchar_t *_Directory
,
969 _In_opt_z_
const wchar_t *_FilePrefix
);
976 _In_z_ _Printf_format_string_
const wchar_t *_Format
,
985 _In_z_ _Scanf_format_string_
const wchar_t *_Format
,
993 _In_z_
const wchar_t *_Src
,
994 _In_z_ _Scanf_format_string_
const wchar_t *_Format
,
1002 _In_reads_(_MaxCount
) _Pre_z_
const wchar_t *_Src
,
1003 _In_
size_t _MaxCount
,
1004 _In_z_ _Scanf_format_string_
const wchar_t *_Format
,
1012 _In_z_ _Scanf_format_string_
const wchar_t *_Format
,
1020 _In_
int _FileHandle
,
1021 _In_z_
const wchar_t *_Mode
);
1028 _In_z_
const wchar_t *_Filename
,
1029 _In_z_
const wchar_t *_Mode
);
1036 _In_z_
const wchar_t *_Filename
,
1037 _In_z_
const wchar_t *_Mode
,
1038 _Inout_
FILE *_OldFile
);
1040 #ifndef _CRT_WPERROR_DEFINED
1041 #define _CRT_WPERROR_DEFINED
1046 _In_opt_z_
const wchar_t *_ErrMsg
);
1054 _In_z_
const wchar_t *_Command
,
1055 _In_z_
const wchar_t *_Mode
);
1057 #if !defined(NO_OLDNAMES) && !defined(wpopen)
1058 #define wpopen _wpopen
1066 _In_z_
const wchar_t *_Filename
);
1072 _Pre_maybenull_ _Post_z_
wchar_t *_Buffer
);
1079 _Inout_
FILE *_File
);
1087 _Inout_
FILE *_File
);
1095 _Inout_
FILE *_File
);
1097 #undef _CRT_GETPUTWCHAR_NOINLINE
1099 #if !defined(__cplusplus) || defined(_CRT_GETPUTWCHAR_NOINLINE)
1100 #define getwchar() fgetwc(stdin)
1101 #define putwchar(_c) fputwc((_c),stdout)
1103 __CRT_INLINE
wint_t __cdecl
getwchar() { return (fgetwc(stdin
)); }
1104 __CRT_INLINE
wint_t __cdecl
putwchar(wchar_t _C
) { return (fputwc(_C
,stdout
)); }
1107 #define getwc(_stm) fgetwc(_stm)
1108 #define putwc(_c,_stm) fputwc(_c,_stm)
1109 #define _putwc_nolock(_c,_stm) _fputwc_nolock(_c,_stm)
1110 #define _getwc_nolock(_stm) _fgetwc_nolock(_stm)
1112 #define _WSTDIO_DEFINED
1115 #define _STDIO_DEFINED
1118 #define _fgetc_nolock(_stream) (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ : _filbuf(_stream))
1119 #define _fputc_nolock(_c,_stream) (--(_stream)->_cnt >= 0 ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream)))
1120 #define _getc_nolock(_stream) _fgetc_nolock(_stream)
1121 #define _putc_nolock(_c,_stream) _fputc_nolock(_c,_stream)
1122 #define _getchar_nolock() _getc_nolock(stdin)
1123 #define _putchar_nolock(_c) _putc_nolock((_c),stdout)
1124 #define _getwchar_nolock() _getwc_nolock(stdin)
1125 #define _putwchar_nolock(_c) _putwc_nolock((_c),stdout)
1131 _Inout_
FILE *_File
);
1137 _Inout_
FILE *_File
);
1144 _Inout_
FILE *_File
);
1151 _Inout_opt_
FILE *_File
);
1158 _Out_writes_bytes_(_ElementSize
* _Count
) void *_DstBuf
,
1159 _In_
size_t _ElementSize
,
1161 _Inout_
FILE *_File
);
1168 _Inout_
FILE *_File
,
1177 _Inout_
FILE *_File
);
1185 _Inout_
FILE *_File
,
1186 _In_ __int64 _Offset
,
1195 _Inout_
FILE *_File
);
1202 _In_reads_bytes_(_Size
* _Count
) const void *_DstBuf
,
1205 _Inout_
FILE *_File
);
1213 _Inout_
FILE *_File
);
1215 #if !defined(NO_OLDNAMES) || !defined(_POSIX)
1217 #define P_tmpdir _P_tmpdir
1218 #define SYS_OPEN _SYS_OPEN
1224 _In_opt_z_
const char *_Directory
,
1225 _In_opt_z_
const char *_FilePrefix
);
1238 _In_
int _FileHandle
,
1239 _In_z_
const char *_Format
);
1272 _Inout_
FILE *_File
);
1280 _Inout_
FILE *_File
);
1288 #endif /* !defined(NO_OLDNAMES) || !defined(_POSIX) */
1296 #include <sec_api/stdio_s.h>