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(__x86_64__) && !defined(_WIN64)
24 #if !defined(_MSC_VER) && !defined(__int64)
28 # define __int64 long long
32 /* file._flag flags */
33 #define _IOREAD 0x0001
35 #define _IOMYBUF 0x0008
38 #define _IOSTRG 0x0040
45 #define NULL ((void *)0)
49 #define STDIN_FILENO 0
50 #define STDOUT_FILENO 1
51 #define STDERR_FILENO 2
53 /* more file._flag flags, but these conflict with Unix */
59 #define FILENAME_MAX 260
60 #define TMP_MAX 0x7fff
85 #endif /* _FILE_DEFINED */
87 #ifndef _FPOS_T_DEFINED
88 typedef __int64
fpos_t;
89 #define _FPOS_T_DEFINED
92 #ifndef _SIZE_T_DEFINED
94 typedef unsigned __int64
size_t;
96 typedef unsigned int size_t;
98 #define _SIZE_T_DEFINED
101 #ifndef _WCHAR_T_DEFINED
102 #define _WCHAR_T_DEFINED
104 typedef unsigned short wchar_t;
108 #ifndef _WCTYPE_T_DEFINED
109 typedef unsigned short wint_t;
110 typedef unsigned short wctype_t;
111 #define _WCTYPE_T_DEFINED
118 #ifndef _STDIO_DEFINED
119 FILE* __p__iob(void);
120 #define _iob (__p__iob())
121 #endif /* _STDIO_DEFINED */
123 #define stdin (_iob+STDIN_FILENO)
124 #define stdout (_iob+STDOUT_FILENO)
125 #define stderr (_iob+STDERR_FILENO)
127 #ifndef _STDIO_DEFINED
128 #define _STDIO_DEFINED
129 int _fcloseall(void);
130 FILE* _fdopen(int,const char*);
134 int _flsbuf(int,FILE*);
137 FILE* _fsopen(const char*,const char*,int);
138 int _getmaxstdio(void);
141 FILE* _popen(const char*,const char*);
142 int _putw(int,FILE*);
144 int _setmaxstdio(int);
145 int _snprintf(char*,size_t,const char*,...);
146 char* _tempnam(const char*,const char*);
147 int _unlink(const char*);
148 int _vsnprintf(char*,size_t,const char*,va_list);
150 void clearerr(FILE*);
156 int fgetpos(FILE*,fpos_t*);
157 char* fgets(char*,int,FILE*);
158 FILE* fopen(const char*,const char*);
159 int fprintf(FILE*,const char*,...);
160 int fputc(int,FILE*);
161 int fputs(const char*,FILE*);
162 size_t fread(void*,size_t,size_t,FILE*);
163 FILE* freopen(const char*,const char*,FILE*);
164 int fscanf(FILE*,const char*,...);
165 int fseek(FILE*,long,int);
166 int fsetpos(FILE*,fpos_t*);
168 size_t fwrite(const void*,size_t,size_t,FILE*);
172 void perror(const char*);
173 int printf(const char*,...);
176 int puts(const char*);
177 int remove(const char*);
178 int rename(const char*,const char*);
180 int scanf(const char*,...);
181 void setbuf(FILE*,char*);
182 int setvbuf(FILE*,char*,int,size_t);
183 int sprintf(char*,const char*,...);
184 int sscanf(const char*,const char*,...);
187 int ungetc(int,FILE*);
188 int vfprintf(FILE*,const char*,va_list);
189 int vprintf(const char*,va_list);
190 int vsprintf(char*,const char*,va_list);
192 #ifndef _WSTDIO_DEFINED
193 #define _WSTDIO_DEFINED
194 wint_t _fgetwchar(void);
195 wint_t _fputwchar(wint_t);
196 wchar_t*_getws(wchar_t*);
197 int _putws(const wchar_t*);
198 int _snwprintf(wchar_t*,size_t,const wchar_t*,...);
199 int _vsnwprintf(wchar_t*,size_t,const wchar_t*,va_list);
200 FILE* _wfdopen(int,const wchar_t*);
201 FILE* _wfopen(const wchar_t*,const wchar_t*);
202 FILE* _wfreopen(const wchar_t*,const wchar_t*,FILE*);
203 FILE* _wfsopen(const wchar_t*,const wchar_t*,int);
204 void _wperror(const wchar_t*);
205 FILE* _wpopen(const wchar_t*,const wchar_t*);
206 int _wremove(const wchar_t*);
207 wchar_t*_wtempnam(const wchar_t*,const wchar_t*);
208 wchar_t*_wtmpnam(wchar_t*);
210 wint_t fgetwc(FILE*);
211 wchar_t*fgetws(wchar_t*,int,FILE*);
212 wint_t fputwc(wint_t,FILE*);
213 int fputws(const wchar_t*,FILE*);
214 int fwprintf(FILE*,const wchar_t*,...);
215 int fputws(const wchar_t*,FILE*);
216 int fwscanf(FILE*,const wchar_t*,...);
218 wint_t getwchar(void);
219 wchar_t*getws(wchar_t*);
220 wint_t putwc(wint_t,FILE*);
221 wint_t putwchar(wint_t);
222 int putws(const wchar_t*);
223 int swprintf(wchar_t*,const wchar_t*,...);
224 int swscanf(const wchar_t*,const wchar_t*,...);
225 wint_t ungetwc(wint_t,FILE*);
226 int vfwprintf(FILE*,const wchar_t*,va_list);
227 int vswprintf(wchar_t*,const wchar_t*,va_list);
228 int vwprintf(const wchar_t*,va_list);
229 int wprintf(const wchar_t*,...);
230 int wscanf(const wchar_t*,...);
231 #endif /* _WSTDIO_DEFINED */
233 #endif /* _STDIO_DEFINED */
240 static inline FILE* fdopen(int fd
, const char *mode
) { return _fdopen(fd
, mode
); }
241 static inline int fgetchar(void) { return _fgetchar(); }
242 static inline int fileno(FILE* file
) { return _fileno(file
); }
243 static inline int fputchar(int c
) { return _fputchar(c
); }
244 static inline int pclose(FILE* file
) { return _pclose(file
); }
245 static inline FILE* popen(const char* command
, const char* mode
) { return _popen(command
, mode
); }
246 static inline char* tempnam(const char *dir
, const char *prefix
) { return _tempnam(dir
, prefix
); }
247 #ifndef _UNLINK_DEFINED
248 static inline int unlink(const char* path
) { return _unlink(path
); }
249 #define _UNLINK_DEFINED
251 static inline int vsnprintf(char *buffer
, size_t size
, const char *format
, va_list args
) { return _vsnprintf(buffer
,size
,format
,args
); }
253 static inline wint_t fgetwchar(void) { return _fgetwchar(); }
254 static inline wint_t fputwchar(wint_t wc
) { return _fputwchar(wc
); }
255 static inline int getw(FILE* file
) { return _getw(file
); }
256 static inline int putw(int val
, FILE* file
) { return _putw(val
, file
); }
257 static inline FILE* wpopen(const wchar_t* command
,const wchar_t* mode
) { return _wpopen(command
, mode
); }
261 #endif /* __WINE_STDIO_H */