msxml3/tests: Avoid an unneeded lstrlenW() call.
[wine/zf.git] / include / msvcrt / stdio.h
blob6d0aaeaa6c5fae96df59fad9f46bd5b402dd59be
1 /*
2 * Standard I/O definitions.
4 * Derived from the mingw header written by Colin Peters.
5 * Modified for Wine use by Jon Griffiths and Francois Gouget.
6 * This file is in the public domain.
7 */
8 #ifndef __WINE_STDIO_H
9 #define __WINE_STDIO_H
11 #include <corecrt.h>
13 #ifndef RC_INVOKED
14 #include <stdarg.h>
15 #endif
17 #include <pshpack8.h>
19 /* file._flag flags */
20 #define _IOREAD 0x0001
21 #define _IOWRT 0x0002
22 #define _IOMYBUF 0x0008
23 #define _IOEOF 0x0010
24 #define _IOERR 0x0020
25 #define _IOSTRG 0x0040
26 #define _IORW 0x0080
28 #ifndef NULL
29 #ifdef __cplusplus
30 #define NULL 0
31 #else
32 #define NULL ((void *)0)
33 #endif
34 #endif
36 #define STDIN_FILENO 0
37 #define STDOUT_FILENO 1
38 #define STDERR_FILENO 2
40 /* more file._flag flags, but these conflict with Unix */
41 #define _IOFBF 0x0000
42 #define _IONBF 0x0004
43 #define _IOLBF 0x0040
45 #define EOF (-1)
46 #define FILENAME_MAX 260
47 #define TMP_MAX 0x7fff
48 #define FOPEN_MAX 20
49 #define L_tmpnam 260
51 #define BUFSIZ 512
53 #ifndef SEEK_SET
54 #define SEEK_SET 0
55 #define SEEK_CUR 1
56 #define SEEK_END 2
57 #endif
59 #ifndef _FILE_DEFINED
60 #define _FILE_DEFINED
61 typedef struct _iobuf
63 char* _ptr;
64 int _cnt;
65 char* _base;
66 int _flag;
67 int _file;
68 int _charbuf;
69 int _bufsiz;
70 char* _tmpfname;
71 } FILE;
72 #endif /* _FILE_DEFINED */
74 #ifndef _FPOS_T_DEFINED
75 typedef __int64 DECLSPEC_ALIGN(8) fpos_t;
76 #define _FPOS_T_DEFINED
77 #endif
79 #ifdef __cplusplus
80 extern "C" {
81 #endif
83 #ifndef _STDIO_DEFINED
84 # ifdef __i386__
85 FILE* __cdecl __p__iob(void);
86 # define _iob (__p__iob())
87 # else
88 FILE* __cdecl __iob_func(void);
89 # define _iob (__iob_func())
90 # endif
91 #endif /* _STDIO_DEFINED */
93 FILE *__cdecl __acrt_iob_func(unsigned index);
95 #define stdin (__acrt_iob_func(0))
96 #define stdout (__acrt_iob_func(1))
97 #define stderr (__acrt_iob_func(2))
99 /* return value for _get_output_format */
100 #define _TWO_DIGIT_EXPONENT 0x1
102 #ifndef _STDIO_DEFINED
103 #define _STDIO_DEFINED
104 int __cdecl _fcloseall(void);
105 FILE* __cdecl _fdopen(int,const char*);
106 int __cdecl _fgetchar(void);
107 int __cdecl _filbuf(FILE*);
108 int __cdecl _fileno(FILE*);
109 int __cdecl _flsbuf(int,FILE*);
110 int __cdecl _flushall(void);
111 int __cdecl _fputchar(int);
112 FILE* __cdecl _fsopen(const char*,const char*,int);
113 int __cdecl _get_printf_count_output(void);
114 int __cdecl _getmaxstdio(void);
115 int __cdecl _getw(FILE*);
116 int __cdecl _pclose(FILE*);
117 FILE* __cdecl _popen(const char*,const char*);
118 int __cdecl _putw(int,FILE*);
119 int __cdecl _rmtmp(void);
120 int __cdecl _set_printf_count_output(int);
121 int __cdecl _setmaxstdio(int);
122 int WINAPIV _snprintf(char*,size_t,const char*,...);
123 int WINAPIV _snprintf_s(char*,size_t,size_t,const char*,...);
124 char* __cdecl _tempnam(const char*,const char*);
125 int __cdecl _unlink(const char*);
126 int WINAPIV _scprintf(const char*,...);
127 int __cdecl _vscprintf(const char*,__ms_va_list);
128 int __cdecl _vsnprintf(char*,size_t,const char*,__ms_va_list);
129 int __cdecl _vsnprintf_s(char*,size_t,size_t,const char*,__ms_va_list);
130 int __cdecl _vsprintf_p_l(char*,size_t,const char*,_locale_t,__ms_va_list);
132 size_t __cdecl _fread_nolock(void*,size_t,size_t,FILE*);
133 size_t __cdecl _fread_nolock_s(void*,size_t,size_t,size_t,FILE*);
134 size_t __cdecl _fwrite_nolock(const void*,size_t,size_t,FILE*);
135 int __cdecl _fclose_nolock(FILE*);
136 int __cdecl _fflush_nolock(FILE*);
137 int __cdecl _fgetc_nolock(FILE*);
138 int __cdecl _fputc_nolock(int,FILE*);
139 int __cdecl _fseek_nolock(FILE*,__msvcrt_long,int);
140 int __cdecl _fseeki64_nolock(FILE*,__int64,int);
141 __msvcrt_long __cdecl _ftell_nolock(FILE*);
142 __int64 __cdecl _ftelli64_nolock(FILE*);
143 int __cdecl _getc_nolock(FILE*);
144 int __cdecl _putc_nolock(int,FILE*);
145 int __cdecl _ungetc_nolock(int,FILE*);
147 void __cdecl clearerr(FILE*);
148 errno_t __cdecl clearerr_s(FILE*);
149 int __cdecl fclose(FILE*);
150 int __cdecl feof(FILE*);
151 int __cdecl ferror(FILE*);
152 int __cdecl fflush(FILE*);
153 int __cdecl fgetc(FILE*);
154 int __cdecl fgetpos(FILE*,fpos_t*);
155 char* __cdecl fgets(char*,int,FILE*);
156 FILE* __cdecl fopen(const char*,const char*);
157 errno_t __cdecl fopen_s(FILE**,const char*,const char*);
158 int WINAPIV fprintf(FILE*,const char*,...);
159 int WINAPIV fprintf_s(FILE*,const char*,...);
160 int __cdecl fputc(int,FILE*);
161 int __cdecl fputs(const char*,FILE*);
162 size_t __cdecl fread(void*,size_t,size_t,FILE*);
163 size_t __cdecl fread_s(void*,size_t,size_t,size_t,FILE*);
164 FILE* __cdecl freopen(const char*,const char*,FILE*);
165 int WINAPIV fscanf(FILE*,const char*,...);
166 int WINAPIV fscanf_s(FILE*,const char*,...);
167 int __cdecl fseek(FILE*,__msvcrt_long,int);
168 int __cdecl _fseeki64(FILE*,__int64,int);
169 int __cdecl fsetpos(FILE*,fpos_t*);
170 __msvcrt_long __cdecl ftell(FILE*);
171 __int64 __cdecl _ftelli64(FILE*);
172 size_t __cdecl fwrite(const void*,size_t,size_t,FILE*);
173 int __cdecl getc(FILE*);
174 int __cdecl getchar(void);
175 char* __cdecl gets(char*);
176 void __cdecl perror(const char*);
177 int WINAPIV printf(const char*,...);
178 int WINAPIV printf_s(const char*,...);
179 int __cdecl putc(int,FILE*);
180 int __cdecl putchar(int);
181 int __cdecl puts(const char*);
182 int __cdecl remove(const char*);
183 int __cdecl rename(const char*,const char*);
184 void __cdecl rewind(FILE*);
185 int WINAPIV scanf(const char*,...);
186 int WINAPIV scanf_s(const char*,...);
187 void __cdecl setbuf(FILE*,char*);
188 int __cdecl setvbuf(FILE*,char*,int,size_t);
189 int WINAPIV sprintf(char*,const char*,...);
190 int WINAPIV sprintf_s(char*,size_t,const char*,...);
191 int WINAPIV _scprintf(const char *, ...);
192 int WINAPIV sscanf(const char*,const char*,...);
193 int WINAPIV sscanf_s(const char*,const char*,...);
194 FILE* __cdecl tmpfile(void);
195 char* __cdecl tmpnam(char*);
196 int __cdecl ungetc(int,FILE*);
197 int __cdecl vfprintf(FILE*,const char*,__ms_va_list);
198 int __cdecl vfprintf_s(FILE*,const char*,__ms_va_list);
199 int __cdecl vprintf(const char*,__ms_va_list);
200 int __cdecl vprintf_s(const char*,__ms_va_list);
201 int __cdecl vsprintf(char*,const char*,__ms_va_list);
202 int __cdecl vsprintf_s(char*,size_t,const char*,__ms_va_list);
203 unsigned int __cdecl _get_output_format(void);
204 unsigned int __cdecl _set_output_format(void);
206 #ifndef _WSTDIO_DEFINED
207 #define _WSTDIO_DEFINED
208 wint_t __cdecl _fgetwc_nolock(FILE*);
209 wint_t __cdecl _fgetwchar(void);
210 wint_t __cdecl _fputwc_nolock(wint_t,FILE*);
211 wint_t __cdecl _fputwchar(wint_t);
212 wint_t __cdecl _getwc_nolock(FILE*);
213 wchar_t* __cdecl _getws(wchar_t*);
214 wint_t __cdecl _putwc_nolock(wint_t,FILE*);
215 int __cdecl _putws(const wchar_t*);
216 int WINAPIV _snwprintf(wchar_t*,size_t,const wchar_t*,...);
217 int WINAPIV _snwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,...);
218 int WINAPIV _scwprintf(const wchar_t*,...);
219 wint_t __cdecl _ungetwc_nolock(wint_t,FILE*);
220 int __cdecl _vscwprintf(const wchar_t*,__ms_va_list);
221 int __cdecl _vscwprintf_p_l(const wchar_t*,_locale_t,__ms_va_list);
222 int __cdecl _vsnwprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list);
223 int __cdecl _vsnwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,__ms_va_list);
224 int __cdecl _vswprintf_p_l(wchar_t*,size_t,const wchar_t*,_locale_t,__ms_va_list);
225 FILE* __cdecl _wfdopen(int,const wchar_t*);
226 FILE* __cdecl _wfopen(const wchar_t*,const wchar_t*);
227 errno_t __cdecl _wfopen_s(FILE**,const wchar_t*,const wchar_t*);
228 FILE* __cdecl _wfreopen(const wchar_t*,const wchar_t*,FILE*);
229 FILE* __cdecl _wfsopen(const wchar_t*,const wchar_t*,int);
230 void __cdecl _wperror(const wchar_t*);
231 FILE* __cdecl _wpopen(const wchar_t*,const wchar_t*);
232 int __cdecl _wremove(const wchar_t*);
233 wchar_t* __cdecl _wtempnam(const wchar_t*,const wchar_t*);
234 wchar_t* __cdecl _wtmpnam(wchar_t*);
236 wint_t __cdecl fgetwc(FILE*);
237 wchar_t* __cdecl fgetws(wchar_t*,int,FILE*);
238 wint_t __cdecl fputwc(wint_t,FILE*);
239 int __cdecl fputws(const wchar_t*,FILE*);
240 int WINAPIV fwprintf(FILE*,const wchar_t*,...);
241 int WINAPIV fwprintf_s(FILE*,const wchar_t*,...);
242 int __cdecl fputws(const wchar_t*,FILE*);
243 int WINAPIV fwscanf(FILE*,const wchar_t*,...);
244 int WINAPIV fwscanf_s(FILE*,const wchar_t*,...);
245 wint_t __cdecl getwc(FILE*);
246 wint_t __cdecl getwchar(void);
247 wchar_t* __cdecl getws(wchar_t*);
248 wint_t __cdecl putwc(wint_t,FILE*);
249 wint_t __cdecl putwchar(wint_t);
250 int __cdecl putws(const wchar_t*);
251 int WINAPIV swprintf_s(wchar_t*,size_t,const wchar_t*,...);
252 int WINAPIV swscanf(const wchar_t*,const wchar_t*,...);
253 int WINAPIV swscanf_s(const wchar_t*,const wchar_t*,...);
254 wint_t __cdecl ungetwc(wint_t,FILE*);
255 int __cdecl vfwprintf(FILE*,const wchar_t*,__ms_va_list);
256 int __cdecl vfwprintf_s(FILE*,const wchar_t*,__ms_va_list);
257 int __cdecl vswprintf_s(wchar_t*,size_t,const wchar_t*,__ms_va_list);
258 int __cdecl vwprintf(const wchar_t*,__ms_va_list);
259 int __cdecl vwprintf_s(const wchar_t*,__ms_va_list);
260 int WINAPIV wprintf(const wchar_t*,...);
261 int WINAPIV wprintf_s(const wchar_t*,...);
262 int WINAPIV wscanf(const wchar_t*,...);
263 int WINAPIV wscanf_s(const wchar_t*,...);
265 #ifdef _CRT_NON_CONFORMING_SWPRINTFS
266 int WINAPIV swprintf(wchar_t*,const wchar_t*,...);
267 int __cdecl vswprintf(wchar_t*,const wchar_t*,__ms_va_list);
268 #else /* _CRT_NON_CONFORMING_SWPRINTFS */
269 static inline int vswprintf(wchar_t *buffer, size_t size, const wchar_t *format, __ms_va_list args) { return _vsnwprintf(buffer,size,format,args); }
270 static inline int WINAPIV swprintf(wchar_t *buffer, size_t size, const wchar_t *format, ...)
272 int ret;
273 __ms_va_list args;
275 __ms_va_start(args, format);
276 ret = _vsnwprintf(buffer, size, format, args);
277 __ms_va_end(args);
278 return ret;
280 #endif /* _CRT_NON_CONFORMING_SWPRINTFS */
282 #endif /* _WSTDIO_DEFINED */
284 #endif /* _STDIO_DEFINED */
286 #ifdef __cplusplus
288 #endif
291 static inline FILE* fdopen(int fd, const char *mode) { return _fdopen(fd, mode); }
292 static inline int fgetchar(void) { return _fgetchar(); }
293 static inline int fileno(FILE* file) { return _fileno(file); }
294 static inline int fputchar(int c) { return _fputchar(c); }
295 static inline int pclose(FILE* file) { return _pclose(file); }
296 static inline FILE* popen(const char* command, const char* mode) { return _popen(command, mode); }
297 static inline char* tempnam(const char *dir, const char *prefix) { return _tempnam(dir, prefix); }
298 #ifndef _UNLINK_DEFINED
299 static inline int unlink(const char* path) { return _unlink(path); }
300 #define _UNLINK_DEFINED
301 #endif
302 static inline int vsnprintf(char *buffer, size_t size, const char *format, __ms_va_list args) { return _vsnprintf(buffer,size,format,args); }
303 #define snprintf _snprintf
305 static inline wint_t fgetwchar(void) { return _fgetwchar(); }
306 static inline wint_t fputwchar(wint_t wc) { return _fputwchar(wc); }
307 static inline int getw(FILE* file) { return _getw(file); }
308 static inline int putw(int val, FILE* file) { return _putw(val, file); }
309 static inline FILE* wpopen(const wchar_t* command,const wchar_t* mode) { return _wpopen(command, mode); }
311 #include <poppack.h>
313 #endif /* __WINE_STDIO_H */