Added a few functions that are now implemented.
[wine/wine-kai.git] / include / msvcrt / stdio.h
blobfb881e27d7ee0ed85d7beef2ab1792b0d754a394
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
10 #ifndef __WINE_USE_MSVCRT
11 #define __WINE_USE_MSVCRT
12 #endif
14 #ifndef RC_INVOKED
15 #include <stdarg.h>
16 #endif
18 /* file._flag flags */
19 #define _IOREAD 0x0001
20 #define _IOWRT 0x0002
21 #define _IOMYBUF 0x0008
22 #define _IOEOF 0x0010
23 #define _IOERR 0x0020
24 #define _IOSTRG 0x0040
25 #define _IORW 0x0080
27 #ifndef NULL
28 #ifdef __cplusplus
29 #define NULL 0
30 #else
31 #define NULL ((void *)0)
32 #endif
33 #endif
35 #define STDIN_FILENO 0
36 #define STDOUT_FILENO 1
37 #define STDERR_FILENO 2
39 /* more file._flag flags, but these conflict with Unix */
40 #define _IOFBF 0x0000
41 #define _IONBF 0x0004
42 #define _IOLBF 0x0040
44 #define EOF (-1)
45 #define FILENAME_MAX 260
46 #define TMP_MAX 0x7fff
47 #define FOPEN_MAX 20
48 #define L_tmpnam 260
50 #define BUFSIZ 512
52 #ifndef SEEK_SET
53 #define SEEK_SET 0
54 #define SEEK_CUR 1
55 #define SEEK_END 2
56 #endif
58 #ifndef _FILE_DEFINED
59 #define _FILE_DEFINED
60 typedef struct _iobuf
62 char* _ptr;
63 int _cnt;
64 char* _base;
65 int _flag;
66 int _file;
67 int _charbuf;
68 int _bufsiz;
69 char* _tmpfname;
70 } FILE;
71 #endif /* _FILE_DEFINED */
73 #ifndef _FPOS_T_DEFINED
74 typedef long fpos_t;
75 #define _FPOS_T_DEFINED
76 #endif
78 #ifndef _SIZE_T_DEFINED
79 typedef unsigned int size_t;
80 #define _SIZE_T_DEFINED
81 #endif
83 #ifndef _WCHAR_T_DEFINED
84 #define _WCHAR_T_DEFINED
85 #ifndef __cplusplus
86 typedef unsigned short wchar_t;
87 #endif
88 #endif
90 #ifndef _WCTYPE_T_DEFINED
91 typedef unsigned short wint_t;
92 typedef unsigned short wctype_t;
93 #define _WCTYPE_T_DEFINED
94 #endif
96 #ifdef __cplusplus
97 extern "C" {
98 #endif
100 #ifndef _STDIO_DEFINED
101 FILE* __p__iob(void);
102 #define _iob (__p__iob())
103 #endif /* _STDIO_DEFINED */
105 #define stdin (_iob+STDIN_FILENO)
106 #define stdout (_iob+STDOUT_FILENO)
107 #define stderr (_iob+STDERR_FILENO)
109 #ifndef _STDIO_DEFINED
110 #define _STDIO_DEFINED
111 int _fcloseall(void);
112 FILE* _fdopen(int,const char*);
113 int _fgetchar(void);
114 int _filbuf(FILE*);
115 int _fileno(FILE*);
116 int _flsbuf(int,FILE*);
117 int _flushall(void);
118 int _fputchar(int);
119 FILE* _fsopen(const char*,const char*,int);
120 int _getmaxstdio(void);
121 int _getw(FILE*);
122 int _pclose(FILE*);
123 FILE* _popen(const char*,const char*);
124 int _putw(int,FILE*);
125 int _rmtmp(void);
126 int _setmaxstdio(int);
127 int _snprintf(char*,size_t,const char*,...);
128 char* _tempnam(const char*,const char*);
129 int _unlink(const char*);
130 int _vsnprintf(char*,size_t,const char*,va_list);
132 void clearerr(FILE*);
133 int fclose(FILE*);
134 int feof(FILE*);
135 int ferror(FILE*);
136 int fflush(FILE*);
137 int fgetc(FILE*);
138 int fgetpos(FILE*,fpos_t*);
139 char* fgets(char*,int,FILE*);
140 FILE* fopen(const char*,const char*);
141 int fprintf(FILE*,const char*,...);
142 int fputc(int,FILE*);
143 int fputs(const char*,FILE*);
144 size_t fread(void*,size_t,size_t,FILE*);
145 FILE* freopen(const char*,const char*,FILE*);
146 int fscanf(FILE*,const char*,...);
147 int fseek(FILE*,long,int);
148 int fsetpos(FILE*,fpos_t*);
149 long ftell(FILE*);
150 size_t fwrite(const void*,size_t,size_t,FILE*);
151 int getc(FILE*);
152 int getchar(void);
153 char* gets(char*);
154 void perror(const char*);
155 int printf(const char*,...);
156 int putc(int,FILE*);
157 int putchar(int);
158 int puts(const char*);
159 int remove(const char*);
160 int rename(const char*,const char*);
161 void rewind(FILE*);
162 int scanf(const char*,...);
163 void setbuf(FILE*,char*);
164 int setvbuf(FILE*,char*,int,size_t);
165 int sprintf(char*,const char*,...);
166 int sscanf(const char*,const char*,...);
167 FILE* tmpfile(void);
168 char* tmpnam(char*);
169 int ungetc(int,FILE*);
170 int vfprintf(FILE*,const char*,va_list);
171 int vprintf(const char*,va_list);
172 int vsprintf(char*,const char*,va_list);
174 #ifndef _WSTDIO_DEFINED
175 #define _WSTDIO_DEFINED
176 wint_t _fgetwchar(void);
177 wint_t _fputwchar(wint_t);
178 wchar_t*_getws(wchar_t*);
179 int _putws(const wchar_t*);
180 int _snwprintf(wchar_t*,size_t,const wchar_t*,...);
181 int _vsnwprintf(wchar_t*,size_t,const wchar_t*,va_list);
182 FILE* _wfdopen(int,const wchar_t*);
183 FILE* _wfopen(const wchar_t*,const wchar_t*);
184 FILE* _wfreopen(const wchar_t*,const wchar_t*,FILE*);
185 FILE* _wfsopen(const wchar_t*,const wchar_t*,int);
186 void _wperror(const wchar_t*);
187 FILE* _wpopen(const wchar_t*,const wchar_t*);
188 int _wremove(const wchar_t*);
189 wchar_t*_wtempnam(const wchar_t*,const wchar_t*);
190 wchar_t*_wtmpnam(wchar_t*);
192 wint_t fgetwc(FILE*);
193 wchar_t*fgetws(wchar_t*,int,FILE*);
194 wint_t fputwc(wint_t,FILE*);
195 int fputws(const wchar_t*,FILE*);
196 int fwprintf(FILE*,const wchar_t*,...);
197 int fputws(const wchar_t*,FILE*);
198 int fwscanf(FILE*,const wchar_t*,...);
199 wint_t getwc(FILE*);
200 wint_t getwchar(void);
201 wchar_t*getws(wchar_t*);
202 wint_t putwc(wint_t,FILE*);
203 wint_t putwchar(wint_t);
204 int putws(const wchar_t*);
205 int swprintf(wchar_t*,const wchar_t*,...);
206 int swscanf(const wchar_t*,const wchar_t*,...);
207 wint_t ungetwc(wint_t,FILE*);
208 int vfwprintf(FILE*,const wchar_t*,va_list);
209 int vswprintf(wchar_t*,const wchar_t*,va_list);
210 int vwprintf(const wchar_t*,va_list);
211 int wprintf(const wchar_t*,...);
212 int wscanf(const wchar_t*,...);
213 #endif /* _WSTDIO_DEFINED */
215 #endif /* _STDIO_DEFINED */
217 #ifdef __cplusplus
219 #endif
222 static inline FILE* fdopen(int fd, const char *mode) { return _fdopen(fd, mode); }
223 static inline int fgetchar(void) { return _fgetchar(); }
224 static inline int fileno(FILE* file) { return _fileno(file); }
225 static inline int fputchar(int c) { return _fputchar(c); }
226 static inline int pclose(FILE* file) { return _pclose(file); }
227 static inline FILE* popen(const char* command, const char* mode) { return _popen(command, mode); }
228 static inline char* tempnam(const char *dir, const char *prefix) { return _tempnam(dir, prefix); }
229 #ifndef _UNLINK_DEFINED
230 static inline int unlink(const char* path) { return _unlink(path); }
231 #define _UNLINK_DEFINED
232 #endif
233 static inline int vsnprintf(char *buffer, size_t size, const char *format, va_list args) { return _vsnprintf(buffer,size,format,args); }
235 static inline wint_t fgetwchar(void) { return _fgetwchar(); }
236 static inline wint_t fputwchar(wint_t wc) { return _fputwchar(wc); }
237 static inline int getw(FILE* file) { return _getw(file); }
238 static inline int putw(int val, FILE* file) { return _putw(val, file); }
239 static inline FILE* wpopen(const wchar_t* command,const wchar_t* mode) { return _wpopen(command, mode); }
241 #endif /* __WINE_STDIO_H */