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
14 #if !defined(_MSC_VER) && !defined(__int64)
15 /* FIXME: not compatible, but needed for __int64 definition */
23 /* file._flag flags */
24 #define _IOREAD 0x0001
26 #define _IOMYBUF 0x0008
29 #define _IOSTRG 0x0040
36 #define NULL ((void *)0)
40 #define STDIN_FILENO 0
41 #define STDOUT_FILENO 1
42 #define STDERR_FILENO 2
44 /* more file._flag flags, but these conflict with Unix */
50 #define FILENAME_MAX 260
51 #define TMP_MAX 0x7fff
76 #endif /* _FILE_DEFINED */
78 #ifndef _FPOS_T_DEFINED
79 typedef __int64 fpos_t;
80 #define _FPOS_T_DEFINED
83 #ifndef _SIZE_T_DEFINED
84 typedef unsigned int size_t;
85 #define _SIZE_T_DEFINED
88 #ifndef _WCHAR_T_DEFINED
89 #define _WCHAR_T_DEFINED
91 typedef unsigned short wchar_t;
95 #ifndef _WCTYPE_T_DEFINED
96 typedef unsigned short wint_t;
97 typedef unsigned short wctype_t;
98 #define _WCTYPE_T_DEFINED
105 #ifndef _STDIO_DEFINED
106 FILE* __p__iob(void);
107 #define _iob (__p__iob())
108 #endif /* _STDIO_DEFINED */
110 #define stdin (_iob+STDIN_FILENO)
111 #define stdout (_iob+STDOUT_FILENO)
112 #define stderr (_iob+STDERR_FILENO)
114 #ifndef _STDIO_DEFINED
115 #define _STDIO_DEFINED
116 int _fcloseall(void);
117 FILE* _fdopen(int,const char*);
121 int _flsbuf(int,FILE*);
124 FILE* _fsopen(const char*,const char*,int);
125 int _getmaxstdio(void);
128 FILE* _popen(const char*,const char*);
129 int _putw(int,FILE*);
131 int _setmaxstdio(int);
132 int _snprintf(char*,size_t,const char*,...);
133 char* _tempnam(const char*,const char*);
134 int _unlink(const char*);
135 int _vsnprintf(char*,size_t,const char*,va_list);
137 void clearerr(FILE*);
143 int fgetpos(FILE*,fpos_t*);
144 char* fgets(char*,int,FILE*);
145 FILE* fopen(const char*,const char*);
146 int fprintf(FILE*,const char*,...);
147 int fputc(int,FILE*);
148 int fputs(const char*,FILE*);
149 size_t fread(void*,size_t,size_t,FILE*);
150 FILE* freopen(const char*,const char*,FILE*);
151 int fscanf(FILE*,const char*,...);
152 int fseek(FILE*,long,int);
153 int fsetpos(FILE*,fpos_t*);
155 size_t fwrite(const void*,size_t,size_t,FILE*);
159 void perror(const char*);
160 int printf(const char*,...);
163 int puts(const char*);
164 int remove(const char*);
165 int rename(const char*,const char*);
167 int scanf(const char*,...);
168 void setbuf(FILE*,char*);
169 int setvbuf(FILE*,char*,int,size_t);
170 int sprintf(char*,const char*,...);
171 int sscanf(const char*,const char*,...);
174 int ungetc(int,FILE*);
175 int vfprintf(FILE*,const char*,va_list);
176 int vprintf(const char*,va_list);
177 int vsprintf(char*,const char*,va_list);
179 #ifndef _WSTDIO_DEFINED
180 #define _WSTDIO_DEFINED
181 wint_t _fgetwchar(void);
182 wint_t _fputwchar(wint_t);
183 wchar_t*_getws(wchar_t*);
184 int _putws(const wchar_t*);
185 int _snwprintf(wchar_t*,size_t,const wchar_t*,...);
186 int _vsnwprintf(wchar_t*,size_t,const wchar_t*,va_list);
187 FILE* _wfdopen(int,const wchar_t*);
188 FILE* _wfopen(const wchar_t*,const wchar_t*);
189 FILE* _wfreopen(const wchar_t*,const wchar_t*,FILE*);
190 FILE* _wfsopen(const wchar_t*,const wchar_t*,int);
191 void _wperror(const wchar_t*);
192 FILE* _wpopen(const wchar_t*,const wchar_t*);
193 int _wremove(const wchar_t*);
194 wchar_t*_wtempnam(const wchar_t*,const wchar_t*);
195 wchar_t*_wtmpnam(wchar_t*);
197 wint_t fgetwc(FILE*);
198 wchar_t*fgetws(wchar_t*,int,FILE*);
199 wint_t fputwc(wint_t,FILE*);
200 int fputws(const wchar_t*,FILE*);
201 int fwprintf(FILE*,const wchar_t*,...);
202 int fputws(const wchar_t*,FILE*);
203 int fwscanf(FILE*,const wchar_t*,...);
205 wint_t getwchar(void);
206 wchar_t*getws(wchar_t*);
207 wint_t putwc(wint_t,FILE*);
208 wint_t putwchar(wint_t);
209 int putws(const wchar_t*);
210 int swprintf(wchar_t*,const wchar_t*,...);
211 int swscanf(const wchar_t*,const wchar_t*,...);
212 wint_t ungetwc(wint_t,FILE*);
213 int vfwprintf(FILE*,const wchar_t*,va_list);
214 int vswprintf(wchar_t*,const wchar_t*,va_list);
215 int vwprintf(const wchar_t*,va_list);
216 int wprintf(const wchar_t*,...);
217 int wscanf(const wchar_t*,...);
218 #endif /* _WSTDIO_DEFINED */
220 #endif /* _STDIO_DEFINED */
227 static inline FILE* fdopen(int fd, const char *mode) { return _fdopen(fd, mode); }
228 static inline int fgetchar(void) { return _fgetchar(); }
229 static inline int fileno(FILE* file) { return _fileno(file); }
230 static inline int fputchar(int c) { return _fputchar(c); }
231 static inline int pclose(FILE* file) { return _pclose(file); }
232 static inline FILE* popen(const char* command, const char* mode) { return _popen(command, mode); }
233 static inline char* tempnam(const char *dir, const char *prefix) { return _tempnam(dir, prefix); }
234 #ifndef _UNLINK_DEFINED
235 static inline int unlink(const char* path) { return _unlink(path); }
236 #define _UNLINK_DEFINED
238 static inline int vsnprintf(char *buffer, size_t size, const char *format, va_list args) { return _vsnprintf(buffer,size,format,args); }
240 static inline wint_t fgetwchar(void) { return _fgetwchar(); }
241 static inline wint_t fputwchar(wint_t wc) { return _fputwchar(wc); }
242 static inline int getw(FILE* file) { return _getw(file); }
243 static inline int putw(int val, FILE* file) { return _putw(val, file); }
244 static inline FILE* wpopen(const wchar_t* command,const wchar_t* mode) { return _wpopen(command, mode); }
246 #endif /* __WINE_STDIO_H */