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.
10 #ifndef __WINE_USE_MSVCRT
11 #define __WINE_USE_MSVCRT
20 #if !defined(_MSC_VER) && !defined(__int64)
21 #define __int64 long long
24 #if defined(__x86_64__) && !defined(_WIN64)
28 /* file._flag flags */
29 #define _IOREAD 0x0001
31 #define _IOMYBUF 0x0008
34 #define _IOSTRG 0x0040
41 #define NULL ((void *)0)
45 #define STDIN_FILENO 0
46 #define STDOUT_FILENO 1
47 #define STDERR_FILENO 2
49 /* more file._flag flags, but these conflict with Unix */
55 #define FILENAME_MAX 260
56 #define TMP_MAX 0x7fff
81 #endif /* _FILE_DEFINED */
83 #ifndef _FPOS_T_DEFINED
84 typedef __int64
fpos_t;
85 #define _FPOS_T_DEFINED
88 #ifndef _SIZE_T_DEFINED
90 typedef unsigned __int64
size_t;
92 typedef unsigned int size_t;
94 #define _SIZE_T_DEFINED
97 #ifndef _WCHAR_T_DEFINED
98 #define _WCHAR_T_DEFINED
100 typedef unsigned short wchar_t;
104 #ifndef _WCTYPE_T_DEFINED
105 typedef unsigned short wint_t;
106 typedef unsigned short wctype_t;
107 #define _WCTYPE_T_DEFINED
114 #ifndef _STDIO_DEFINED
115 FILE* __p__iob(void);
116 #define _iob (__p__iob())
117 #endif /* _STDIO_DEFINED */
119 #define stdin (_iob+STDIN_FILENO)
120 #define stdout (_iob+STDOUT_FILENO)
121 #define stderr (_iob+STDERR_FILENO)
123 #ifndef _STDIO_DEFINED
124 #define _STDIO_DEFINED
125 int _fcloseall(void);
126 FILE* _fdopen(int,const char*);
130 int _flsbuf(int,FILE*);
133 FILE* _fsopen(const char*,const char*,int);
134 int _getmaxstdio(void);
137 FILE* _popen(const char*,const char*);
138 int _putw(int,FILE*);
140 int _setmaxstdio(int);
141 int _snprintf(char*,size_t,const char*,...);
142 char* _tempnam(const char*,const char*);
143 int _unlink(const char*);
144 int _vsnprintf(char*,size_t,const char*,va_list);
146 void clearerr(FILE*);
152 int fgetpos(FILE*,fpos_t*);
153 char* fgets(char*,int,FILE*);
154 FILE* fopen(const char*,const char*);
155 int fprintf(FILE*,const char*,...);
156 int fputc(int,FILE*);
157 int fputs(const char*,FILE*);
158 size_t fread(void*,size_t,size_t,FILE*);
159 FILE* freopen(const char*,const char*,FILE*);
160 int fscanf(FILE*,const char*,...);
161 int fseek(FILE*,long,int);
162 int fsetpos(FILE*,fpos_t*);
164 size_t fwrite(const void*,size_t,size_t,FILE*);
168 void perror(const char*);
169 int printf(const char*,...);
172 int puts(const char*);
173 int remove(const char*);
174 int rename(const char*,const char*);
176 int scanf(const char*,...);
177 void setbuf(FILE*,char*);
178 int setvbuf(FILE*,char*,int,size_t);
179 int sprintf(char*,const char*,...);
180 int sscanf(const char*,const char*,...);
183 int ungetc(int,FILE*);
184 int vfprintf(FILE*,const char*,va_list);
185 int vprintf(const char*,va_list);
186 int vsprintf(char*,const char*,va_list);
188 #ifndef _WSTDIO_DEFINED
189 #define _WSTDIO_DEFINED
190 wint_t _fgetwchar(void);
191 wint_t _fputwchar(wint_t);
192 wchar_t*_getws(wchar_t*);
193 int _putws(const wchar_t*);
194 int _snwprintf(wchar_t*,size_t,const wchar_t*,...);
195 int _vsnwprintf(wchar_t*,size_t,const wchar_t*,va_list);
196 FILE* _wfdopen(int,const wchar_t*);
197 FILE* _wfopen(const wchar_t*,const wchar_t*);
198 FILE* _wfreopen(const wchar_t*,const wchar_t*,FILE*);
199 FILE* _wfsopen(const wchar_t*,const wchar_t*,int);
200 void _wperror(const wchar_t*);
201 FILE* _wpopen(const wchar_t*,const wchar_t*);
202 int _wremove(const wchar_t*);
203 wchar_t*_wtempnam(const wchar_t*,const wchar_t*);
204 wchar_t*_wtmpnam(wchar_t*);
206 wint_t fgetwc(FILE*);
207 wchar_t*fgetws(wchar_t*,int,FILE*);
208 wint_t fputwc(wint_t,FILE*);
209 int fputws(const wchar_t*,FILE*);
210 int fwprintf(FILE*,const wchar_t*,...);
211 int fputws(const wchar_t*,FILE*);
212 int fwscanf(FILE*,const wchar_t*,...);
214 wint_t getwchar(void);
215 wchar_t*getws(wchar_t*);
216 wint_t putwc(wint_t,FILE*);
217 wint_t putwchar(wint_t);
218 int putws(const wchar_t*);
219 int swprintf(wchar_t*,const wchar_t*,...);
220 int swscanf(const wchar_t*,const wchar_t*,...);
221 wint_t ungetwc(wint_t,FILE*);
222 int vfwprintf(FILE*,const wchar_t*,va_list);
223 int vswprintf(wchar_t*,const wchar_t*,va_list);
224 int vwprintf(const wchar_t*,va_list);
225 int wprintf(const wchar_t*,...);
226 int wscanf(const wchar_t*,...);
227 #endif /* _WSTDIO_DEFINED */
229 #endif /* _STDIO_DEFINED */
236 static inline FILE* fdopen(int fd
, const char *mode
) { return _fdopen(fd
, mode
); }
237 static inline int fgetchar(void) { return _fgetchar(); }
238 static inline int fileno(FILE* file
) { return _fileno(file
); }
239 static inline int fputchar(int c
) { return _fputchar(c
); }
240 static inline int pclose(FILE* file
) { return _pclose(file
); }
241 static inline FILE* popen(const char* command
, const char* mode
) { return _popen(command
, mode
); }
242 static inline char* tempnam(const char *dir
, const char *prefix
) { return _tempnam(dir
, prefix
); }
243 #ifndef _UNLINK_DEFINED
244 static inline int unlink(const char* path
) { return _unlink(path
); }
245 #define _UNLINK_DEFINED
247 static inline int vsnprintf(char *buffer
, size_t size
, const char *format
, va_list args
) { return _vsnprintf(buffer
,size
,format
,args
); }
249 static inline wint_t fgetwchar(void) { return _fgetwchar(); }
250 static inline wint_t fputwchar(wint_t wc
) { return _fputwchar(wc
); }
251 static inline int getw(FILE* file
) { return _getw(file
); }
252 static inline int putw(int val
, FILE* file
) { return _putw(val
, file
); }
253 static inline FILE* wpopen(const wchar_t* command
,const wchar_t* mode
) { return _wpopen(command
, mode
); }
257 #endif /* __WINE_STDIO_H */