msvcrt: Added _fseek_nolock implementation.
[wine.git] / include / msvcrt / stdio.h
blob1c154fcedd5c2ba8e49020ac7d43090e0f8ffc64
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 <crtdefs.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 #define stdin (_iob+STDIN_FILENO)
94 #define stdout (_iob+STDOUT_FILENO)
95 #define stderr (_iob+STDERR_FILENO)
97 /* return value for _get_output_format */
98 #define _TWO_DIGIT_EXPONENT 0x1
100 #ifndef _STDIO_DEFINED
101 #define _STDIO_DEFINED
102 int __cdecl _fcloseall(void);
103 FILE* __cdecl _fdopen(int,const char*);
104 int __cdecl _fgetchar(void);
105 int __cdecl _filbuf(FILE*);
106 int __cdecl _fileno(FILE*);
107 int __cdecl _flsbuf(int,FILE*);
108 int __cdecl _flushall(void);
109 int __cdecl _fputchar(int);
110 FILE* __cdecl _fsopen(const char*,const char*,int);
111 int __cdecl _get_printf_count_output(void);
112 int __cdecl _getmaxstdio(void);
113 int __cdecl _getw(FILE*);
114 int __cdecl _pclose(FILE*);
115 FILE* __cdecl _popen(const char*,const char*);
116 int __cdecl _putw(int,FILE*);
117 int __cdecl _rmtmp(void);
118 int __cdecl _set_printf_count_output(int);
119 int __cdecl _setmaxstdio(int);
120 int __cdecl _snprintf(char*,size_t,const char*,...);
121 int __cdecl _snprintf_s(char*,size_t,size_t,const char*,...);
122 char* __cdecl _tempnam(const char*,const char*);
123 int __cdecl _unlink(const char*);
124 int __cdecl _scprintf(const char*,...);
125 int __cdecl _vscprintf(const char*,__ms_va_list);
126 int __cdecl _vsnprintf(char*,size_t,const char*,__ms_va_list);
127 int __cdecl _vsnprintf_s(char*,size_t,size_t,const char*,__ms_va_list);
128 int __cdecl _vsprintf_p_l(char*,size_t,const char*,_locale_t,__ms_va_list);
130 size_t __cdecl _fread_nolock(void*,size_t,size_t,FILE*);
131 size_t __cdecl _fwrite_nolock(const void*,size_t,size_t,FILE*);
132 int __cdecl _fclose_nolock(FILE*);
133 int __cdecl _fseek_nolock(FILE*,__msvcrt_long,int);
134 int __cdecl _fseeki64_nolock(FILE*,__int64,int);
135 __msvcrt_long __cdecl _ftell_nolock(FILE*);
136 __int64 __cdecl _ftelli64_nolock(FILE*);
138 void __cdecl clearerr(FILE*);
139 int __cdecl fclose(FILE*);
140 int __cdecl feof(FILE*);
141 int __cdecl ferror(FILE*);
142 int __cdecl fflush(FILE*);
143 int __cdecl fgetc(FILE*);
144 int __cdecl fgetpos(FILE*,fpos_t*);
145 char* __cdecl fgets(char*,int,FILE*);
146 FILE* __cdecl fopen(const char*,const char*);
147 errno_t __cdecl fopen_s(FILE**,const char*,const char*);
148 int __cdecl fprintf(FILE*,const char*,...);
149 int __cdecl fprintf_s(FILE*,const char*,...);
150 int __cdecl fputc(int,FILE*);
151 int __cdecl fputs(const char*,FILE*);
152 size_t __cdecl fread(void*,size_t,size_t,FILE*);
153 FILE* __cdecl freopen(const char*,const char*,FILE*);
154 int __cdecl fscanf(FILE*,const char*,...);
155 int __cdecl fscanf_s(FILE*,const char*,...);
156 int __cdecl fseek(FILE*,__msvcrt_long,int);
157 int __cdecl _fseeki64(FILE*,__int64,int);
158 int __cdecl fsetpos(FILE*,fpos_t*);
159 __msvcrt_long __cdecl ftell(FILE*);
160 __int64 __cdecl _ftelli64(FILE*);
161 size_t __cdecl fwrite(const void*,size_t,size_t,FILE*);
162 int __cdecl getc(FILE*);
163 int __cdecl getchar(void);
164 char* __cdecl gets(char*);
165 void __cdecl perror(const char*);
166 int __cdecl printf(const char*,...);
167 int __cdecl printf_s(const char*,...);
168 int __cdecl putc(int,FILE*);
169 int __cdecl putchar(int);
170 int __cdecl puts(const char*);
171 int __cdecl remove(const char*);
172 int __cdecl rename(const char*,const char*);
173 void __cdecl rewind(FILE*);
174 int __cdecl scanf(const char*,...);
175 int __cdecl scanf_s(const char*,...);
176 void __cdecl setbuf(FILE*,char*);
177 int __cdecl setvbuf(FILE*,char*,int,size_t);
178 int __cdecl sprintf(char*,const char*,...);
179 int __cdecl sprintf_s(char*,size_t,const char*,...);
180 int __cdecl _scprintf(const char *, ...);
181 int __cdecl sscanf(const char*,const char*,...);
182 int __cdecl sscanf_s(const char*,const char*,...);
183 FILE* __cdecl tmpfile(void);
184 char* __cdecl tmpnam(char*);
185 int __cdecl ungetc(int,FILE*);
186 int __cdecl vfprintf(FILE*,const char*,__ms_va_list);
187 int __cdecl vfprintf_s(FILE*,const char*,__ms_va_list);
188 int __cdecl vprintf(const char*,__ms_va_list);
189 int __cdecl vprintf_s(const char*,__ms_va_list);
190 int __cdecl vsprintf(char*,const char*,__ms_va_list);
191 int __cdecl vsprintf_s(char*,size_t,const char*,__ms_va_list);
192 unsigned int __cdecl _get_output_format(void);
193 unsigned int __cdecl _set_output_format(void);
195 #ifndef _WSTDIO_DEFINED
196 #define _WSTDIO_DEFINED
197 wint_t __cdecl _fgetwchar(void);
198 wint_t __cdecl _fputwchar(wint_t);
199 wchar_t* __cdecl _getws(wchar_t*);
200 int __cdecl _putws(const wchar_t*);
201 int __cdecl _snwprintf(wchar_t*,size_t,const wchar_t*,...);
202 int __cdecl _snwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,...);
203 int __cdecl _scwprintf(const wchar_t*,...);
204 int __cdecl _vscwprintf(const wchar_t*,__ms_va_list);
205 int __cdecl _vscwprintf_p_l(const wchar_t*,_locale_t,__ms_va_list);
206 int __cdecl _vsnwprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list);
207 int __cdecl _vsnwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,__ms_va_list);
208 int __cdecl _vswprintf_p_l(wchar_t*,size_t,const wchar_t*,_locale_t,__ms_va_list);
209 FILE* __cdecl _wfdopen(int,const wchar_t*);
210 FILE* __cdecl _wfopen(const wchar_t*,const wchar_t*);
211 errno_t __cdecl _wfopen_s(FILE**,const wchar_t*,const wchar_t*);
212 FILE* __cdecl _wfreopen(const wchar_t*,const wchar_t*,FILE*);
213 FILE* __cdecl _wfsopen(const wchar_t*,const wchar_t*,int);
214 void __cdecl _wperror(const wchar_t*);
215 FILE* __cdecl _wpopen(const wchar_t*,const wchar_t*);
216 int __cdecl _wremove(const wchar_t*);
217 wchar_t* __cdecl _wtempnam(const wchar_t*,const wchar_t*);
218 wchar_t* __cdecl _wtmpnam(wchar_t*);
220 wint_t __cdecl fgetwc(FILE*);
221 wchar_t* __cdecl fgetws(wchar_t*,int,FILE*);
222 wint_t __cdecl fputwc(wint_t,FILE*);
223 int __cdecl fputws(const wchar_t*,FILE*);
224 int __cdecl fwprintf(FILE*,const wchar_t*,...);
225 int __cdecl fwprintf_s(FILE*,const wchar_t*,...);
226 int __cdecl fputws(const wchar_t*,FILE*);
227 int __cdecl fwscanf(FILE*,const wchar_t*,...);
228 int __cdecl fwscanf_s(FILE*,const wchar_t*,...);
229 wint_t __cdecl getwc(FILE*);
230 wint_t __cdecl getwchar(void);
231 wchar_t* __cdecl getws(wchar_t*);
232 wint_t __cdecl putwc(wint_t,FILE*);
233 wint_t __cdecl putwchar(wint_t);
234 int __cdecl putws(const wchar_t*);
235 int __cdecl swprintf(wchar_t*,const wchar_t*,...);
236 int __cdecl swprintf_s(wchar_t*,size_t,const wchar_t*,...);
237 int __cdecl swscanf(const wchar_t*,const wchar_t*,...);
238 int __cdecl swscanf_s(const wchar_t*,const wchar_t*,...);
239 wint_t __cdecl ungetwc(wint_t,FILE*);
240 int __cdecl vfwprintf(FILE*,const wchar_t*,__ms_va_list);
241 int __cdecl vfwprintf_s(FILE*,const wchar_t*,__ms_va_list);
242 int __cdecl vswprintf(wchar_t*,const wchar_t*,__ms_va_list);
243 int __cdecl vswprintf_s(wchar_t*,size_t,const wchar_t*,__ms_va_list);
244 int __cdecl vwprintf(const wchar_t*,__ms_va_list);
245 int __cdecl vwprintf_s(const wchar_t*,__ms_va_list);
246 int __cdecl wprintf(const wchar_t*,...);
247 int __cdecl wprintf_s(const wchar_t*,...);
248 int __cdecl wscanf(const wchar_t*,...);
249 int __cdecl wscanf_s(const wchar_t*,...);
250 #endif /* _WSTDIO_DEFINED */
252 #endif /* _STDIO_DEFINED */
254 #ifdef __cplusplus
256 #endif
259 static inline FILE* fdopen(int fd, const char *mode) { return _fdopen(fd, mode); }
260 static inline int fgetchar(void) { return _fgetchar(); }
261 static inline int fileno(FILE* file) { return _fileno(file); }
262 static inline int fputchar(int c) { return _fputchar(c); }
263 static inline int pclose(FILE* file) { return _pclose(file); }
264 static inline FILE* popen(const char* command, const char* mode) { return _popen(command, mode); }
265 static inline char* tempnam(const char *dir, const char *prefix) { return _tempnam(dir, prefix); }
266 #ifndef _UNLINK_DEFINED
267 static inline int unlink(const char* path) { return _unlink(path); }
268 #define _UNLINK_DEFINED
269 #endif
270 static inline int vsnprintf(char *buffer, size_t size, const char *format, __ms_va_list args) { return _vsnprintf(buffer,size,format,args); }
272 static inline wint_t fgetwchar(void) { return _fgetwchar(); }
273 static inline wint_t fputwchar(wint_t wc) { return _fputwchar(wc); }
274 static inline int getw(FILE* file) { return _getw(file); }
275 static inline int putw(int val, FILE* file) { return _putw(val, file); }
276 static inline FILE* wpopen(const wchar_t* command,const wchar_t* mode) { return _wpopen(command, mode); }
278 #include <poppack.h>
280 #endif /* __WINE_STDIO_H */