ReactOS 0.4.16-dev-2104-gb84fa49
stdio.h File Reference
#include <corecrt_wstdio.h>
Include dependency graph for stdio.h:

Go to the source code of this file.

Macros

#define _IOREAD   0x0001
 
#define _IOWRT   0x0002
 
#define _IOMYBUF   0x0008
 
#define _IOEOF   0x0010
 
#define _IOERR   0x0020
 
#define _IOSTRG   0x0040
 
#define _IORW   0x0080
 
#define STDIN_FILENO   0
 
#define STDOUT_FILENO   1
 
#define STDERR_FILENO   2
 
#define _IOFBF   0x0000
 
#define _IONBF   0x0004
 
#define _IOLBF   0x0040
 
#define EOF   (-1)
 
#define FILENAME_MAX   260
 
#define TMP_MAX   0x7fff
 
#define TMP_MAX_S   0x7fffffff
 
#define FOPEN_MAX   20
 
#define L_tmpnam   260
 
#define BUFSIZ   512
 
#define SEEK_SET   0
 
#define SEEK_CUR   1
 
#define SEEK_END   2
 
#define _FPOS_T_DEFINED
 
#define _iob   (__iob_func())
 
#define _TWO_DIGIT_EXPONENT   0x1
 
#define _STDIO_DEFINED
 
#define _UNLINK_DEFINED
 

Typedefs

typedef __int64 DECLSPEC_ALIGN(8) fpos_t
 

Functions

_ACRTIMP FILE *__cdecl __iob_func (void)
 
_ACRTIMP int __cdecl _fcloseall (void)
 
_ACRTIMP FILE *__cdecl _fdopen (int, const char *)
 
_ACRTIMP int __cdecl _fgetchar (void)
 
_ACRTIMP int __cdecl _filbuf (FILE *)
 
_ACRTIMP int __cdecl _fileno (FILE *)
 
_ACRTIMP int __cdecl _flsbuf (int, FILE *)
 
_ACRTIMP int __cdecl _flushall (void)
 
_ACRTIMP int __cdecl _fputchar (int)
 
_ACRTIMP FILE *__cdecl _fsopen (const char *, const char *, int)
 
_ACRTIMP int __cdecl _get_printf_count_output (void)
 
_ACRTIMP int __cdecl _getmaxstdio (void)
 
_ACRTIMP int __cdecl _getw (FILE *)
 
_ACRTIMP int __cdecl _pclose (FILE *)
 
_ACRTIMP FILE *__cdecl _popen (const char *, const char *)
 
_ACRTIMP int __cdecl _putw (int, FILE *)
 
_ACRTIMP int __cdecl _rmtmp (void)
 
_ACRTIMP int __cdecl _set_printf_count_output (int)
 
_ACRTIMP int __cdecl _setmaxstdio (int)
 
_ACRTIMP char *__cdecl _tempnam (const char *, const char *)
 
_ACRTIMP int __cdecl _unlink (const char *)
 
_ACRTIMP void __cdecl _lock_file (FILE *)
 
_ACRTIMP void __cdecl _unlock_file (FILE *)
 
_ACRTIMP size_t __cdecl _fread_nolock (void *, size_t, size_t, FILE *)
 
_ACRTIMP size_t __cdecl _fread_nolock_s (void *, size_t, size_t, size_t, FILE *)
 
_ACRTIMP size_t __cdecl _fwrite_nolock (const void *, size_t, size_t, FILE *)
 
_ACRTIMP int __cdecl _fclose_nolock (FILE *)
 
_ACRTIMP int __cdecl _fflush_nolock (FILE *)
 
_ACRTIMP int __cdecl _fgetc_nolock (FILE *)
 
_ACRTIMP int __cdecl _fputc_nolock (int, FILE *)
 
_ACRTIMP int __cdecl _fseek_nolock (FILE *, __msvcrt_long, int)
 
_ACRTIMP int __cdecl _fseeki64_nolock (FILE *, __int64, int)
 
_ACRTIMP __msvcrt_long __cdecl _ftell_nolock (FILE *)
 
_ACRTIMP __int64 __cdecl _ftelli64_nolock (FILE *)
 
_ACRTIMP int __cdecl _getc_nolock (FILE *)
 
_ACRTIMP int __cdecl _putc_nolock (int, FILE *)
 
_ACRTIMP int __cdecl _ungetc_nolock (int, FILE *)
 
_ACRTIMP void __cdecl clearerr (FILE *)
 
_ACRTIMP errno_t __cdecl clearerr_s (FILE *)
 
_ACRTIMP int __cdecl fclose (FILE *)
 
_ACRTIMP int __cdecl feof (FILE *)
 
_ACRTIMP int __cdecl ferror (FILE *)
 
_ACRTIMP int __cdecl fflush (FILE *)
 
_ACRTIMP int __cdecl fgetc (FILE *)
 
_ACRTIMP int __cdecl fgetpos (FILE *, fpos_t *)
 
_ACRTIMP char *__cdecl fgets (char *, int, FILE *)
 
_ACRTIMP FILE *__cdecl fopen (const char *, const char *)
 
_ACRTIMP errno_t __cdecl fopen_s (FILE **, const char *, const char *)
 
_ACRTIMP int __cdecl fputc (int, FILE *)
 
_ACRTIMP int __cdecl fputs (const char *, FILE *)
 
_ACRTIMP size_t __cdecl fread (void *, size_t, size_t, FILE *)
 
_ACRTIMP size_t __cdecl fread_s (void *, size_t, size_t, size_t, FILE *)
 
_ACRTIMP FILE *__cdecl freopen (const char *, const char *, FILE *)
 
_ACRTIMP errno_t __cdecl freopen_s (FILE **, const char *, const char *, FILE *)
 
_ACRTIMP int __cdecl fseek (FILE *, __msvcrt_long, int)
 
_ACRTIMP int __cdecl _fseeki64 (FILE *, __int64, int)
 
_ACRTIMP int __cdecl fsetpos (FILE *, fpos_t *)
 
_ACRTIMP __msvcrt_long __cdecl ftell (FILE *)
 
_ACRTIMP __int64 __cdecl _ftelli64 (FILE *)
 
_ACRTIMP size_t __cdecl fwrite (const void *, size_t, size_t, FILE *)
 
_ACRTIMP int __cdecl getc (FILE *)
 
_ACRTIMP int __cdecl getchar (void)
 
_ACRTIMP char *__cdecl gets (char *)
 
_ACRTIMP void __cdecl perror (const char *)
 
_ACRTIMP int __cdecl putc (int, FILE *)
 
_ACRTIMP int __cdecl putchar (int)
 
_ACRTIMP int __cdecl puts (const char *)
 
_ACRTIMP int __cdecl remove (const char *)
 
_ACRTIMP int __cdecl rename (const char *, const char *)
 
_ACRTIMP void __cdecl rewind (FILE *)
 
_ACRTIMP void __cdecl setbuf (FILE *, char *)
 
_ACRTIMP int __cdecl setvbuf (FILE *, char *, int, size_t)
 
_ACRTIMP FILE *__cdecl tmpfile (void)
 
_ACRTIMP char *__cdecl tmpnam (char *)
 
_ACRTIMP int __cdecl ungetc (int, FILE *)
 
_ACRTIMP unsigned int __cdecl _get_output_format (void)
 
_ACRTIMP unsigned int __cdecl _set_output_format (unsigned int)
 
_ACRTIMP int __cdecl _scprintf (const char *,...) __WINE_CRT_PRINTF_ATTR(1
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _snprintf_s (char *, size_t, size_t, const char *,...) __WINE_CRT_PRINTF_ATTR(4
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _vscprintf (const char *, va_list) __WINE_CRT_PRINTF_ATTR(1
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _vsnprintf_s (char *, size_t, size_t, const char *, va_list) __WINE_CRT_PRINTF_ATTR(4
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _vsprintf_p_l (char *, size_t, const char *, _locale_t, va_list) __WINE_CRT_PRINTF_ATTR(3
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl fprintf (FILE *, const char *,...) __WINE_CRT_PRINTF_ATTR(2
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl fprintf_s (FILE *, const char *,...) __WINE_CRT_PRINTF_ATTR(2
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl printf (const char *,...) __WINE_CRT_PRINTF_ATTR(1
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl printf_s (const char *,...) __WINE_CRT_PRINTF_ATTR(1
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl sprintf_s (char *, size_t, const char *,...) __WINE_CRT_PRINTF_ATTR(3
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl vfprintf (FILE *, const char *, va_list) __WINE_CRT_PRINTF_ATTR(2
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl vfprintf_s (FILE *, const char *, va_list) __WINE_CRT_PRINTF_ATTR(2
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl vprintf (const char *, va_list) __WINE_CRT_PRINTF_ATTR(1
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl vprintf_s (const char *, va_list) __WINE_CRT_PRINTF_ATTR(1
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl vsprintf (char *, const char *, va_list) __WINE_CRT_PRINTF_ATTR(2
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl vsprintf_s (char *, size_t, const char *, va_list) __WINE_CRT_PRINTF_ATTR(3
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _vsnprintf (char *, size_t, const char *, va_list) __WINE_CRT_PRINTF_ATTR(3
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl static int vsnprintf (char *buffer, size_t size, const char *format, va_list args) __WINE_CRT_PRINTF_ATTR(3
 
_ACRTIMP int __cdecl _snscanf_l (const char *, size_t, const char *, _locale_t,...) __WINE_CRT_SCANF_ATTR(3
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _sscanf_l (const char *, const char *, _locale_t,...) __WINE_CRT_SCANF_ATTR(2
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl fscanf (FILE *, const char *,...) __WINE_CRT_SCANF_ATTR(2
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl fscanf_s (FILE *, const char *,...) __WINE_CRT_SCANF_ATTR(2
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl scanf (const char *,...) __WINE_CRT_SCANF_ATTR(1
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl scanf_s (const char *,...) __WINE_CRT_SCANF_ATTR(1
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl sscanf (const char *, const char *,...) __WINE_CRT_SCANF_ATTR(2
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl sscanf_s (const char *, const char *,...) __WINE_CRT_SCANF_ATTR(2
 
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl static FILEfdopen (int fd, const char *mode)
 
static int fgetchar (void)
 
static int fileno (FILE *file)
 
static int fputchar (int c)
 
static int pclose (FILE *file)
 
static FILEpopen (const char *command, const char *mode)
 
static chartempnam (const char *dir, const char *prefix)
 
static int unlink (const char *path)
 
static int __cdecl snprintf (char *buffer, size_t size, const char *format,...) __WINE_CRT_PRINTF_ATTR(3
 
static int __cdecl _snprintf (char *buffer, size_t size, const char *format,...) __WINE_CRT_PRINTF_ATTR(3
 
static int __cdecl sprintf (char *buffer, const char *format,...) __WINE_CRT_PRINTF_ATTR(2
 
static wint_t fgetwchar (void)
 
static wint_t fputwchar (wint_t wc)
 
static int getw (FILE *file)
 
static int putw (int val, FILE *file)
 
static FILEwpopen (const wchar_t *command, const wchar_t *mode)
 

Macro Definition Documentation

◆ _FPOS_T_DEFINED

#define _FPOS_T_DEFINED

Definition at line 50 of file stdio.h.

◆ _iob

#define _iob   (__iob_func())

Definition at line 63 of file stdio.h.

◆ _IOEOF

#define _IOEOF   0x0010

Definition at line 18 of file stdio.h.

◆ _IOERR

#define _IOERR   0x0020

Definition at line 19 of file stdio.h.

◆ _IOFBF

#define _IOFBF   0x0000

Definition at line 29 of file stdio.h.

◆ _IOLBF

#define _IOLBF   0x0040

Definition at line 31 of file stdio.h.

◆ _IOMYBUF

#define _IOMYBUF   0x0008

Definition at line 17 of file stdio.h.

◆ _IONBF

#define _IONBF   0x0004

Definition at line 30 of file stdio.h.

◆ _IOREAD

#define _IOREAD   0x0001

Definition at line 15 of file stdio.h.

◆ _IORW

#define _IORW   0x0080

Definition at line 21 of file stdio.h.

◆ _IOSTRG

#define _IOSTRG   0x0040

Definition at line 20 of file stdio.h.

◆ _IOWRT

#define _IOWRT   0x0002

Definition at line 16 of file stdio.h.

◆ _STDIO_DEFINED

#define _STDIO_DEFINED

Definition at line 71 of file stdio.h.

◆ _TWO_DIGIT_EXPONENT

#define _TWO_DIGIT_EXPONENT   0x1

Definition at line 68 of file stdio.h.

◆ _UNLINK_DEFINED

#define _UNLINK_DEFINED

Definition at line 489 of file stdio.h.

◆ BUFSIZ

#define BUFSIZ   512

Definition at line 40 of file stdio.h.

◆ EOF

#define EOF   (-1)

Definition at line 33 of file stdio.h.

◆ FILENAME_MAX

#define FILENAME_MAX   260

Definition at line 34 of file stdio.h.

◆ FOPEN_MAX

#define FOPEN_MAX   20

Definition at line 37 of file stdio.h.

◆ L_tmpnam

#define L_tmpnam   260

Definition at line 38 of file stdio.h.

◆ SEEK_CUR

#define SEEK_CUR   1

Definition at line 44 of file stdio.h.

◆ SEEK_END

#define SEEK_END   2

Definition at line 45 of file stdio.h.

◆ SEEK_SET

#define SEEK_SET   0

Definition at line 43 of file stdio.h.

◆ STDERR_FILENO

#define STDERR_FILENO   2

Definition at line 26 of file stdio.h.

◆ STDIN_FILENO

#define STDIN_FILENO   0

Definition at line 24 of file stdio.h.

◆ STDOUT_FILENO

#define STDOUT_FILENO   1

Definition at line 25 of file stdio.h.

◆ TMP_MAX

#define TMP_MAX   0x7fff

Definition at line 35 of file stdio.h.

◆ TMP_MAX_S

#define TMP_MAX_S   0x7fffffff

Definition at line 36 of file stdio.h.

Typedef Documentation

◆ DECLSPEC_ALIGN

typedef __int64 DECLSPEC_ALIGN(8) fpos_t

Definition at line 49 of file stdio.h.

Function Documentation

◆ __iob_func()

_ACRTIMP FILE *__cdecl __iob_func ( void  )

Definition at line 972 of file file.c.

973{
974 return iob_get_file(0);
975}
static FILE * iob_get_file(int i)
Definition: file.c:265

◆ _fclose_nolock()

_ACRTIMP int __cdecl _fclose_nolock ( FILE file)

Definition at line 3773 of file file.c.

3774{
3775 int r, flag;
3776
3777 if (!MSVCRT_CHECK_PMT(file != NULL)) return EOF;
3778
3779 if(!(file->_flag & (_IOREAD | _IOWRT | _IORW)))
3780 {
3781 file->_flag = 0;
3782 return EOF;
3783 }
3784
3785 flag = file->_flag;
3786 free(file->_tmpfname);
3787 file->_tmpfname = NULL;
3788 /* flush stdio buffers */
3789 if(file->_flag & _IOWRT)
3791 if(file->_flag & _IOMYBUF)
3792 free(file->_base);
3793
3794 r=_close(file->_file);
3795 file->_flag = 0;
3796
3797 return ((r == -1) || (flag & _IOERR) ? EOF : 0);
3798}
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112
int CDECL _fflush_nolock(FILE *file)
Definition: file.c:1201
int CDECL _close(int fd)
Definition: file.c:1219
#define _IOMYBUF
Definition: stdio.h:17
#define _IOWRT
Definition: stdio.h:16
#define EOF
Definition: stdio.h:33
#define _IOREAD
Definition: stdio.h:15
#define _IORW
Definition: stdio.h:21
#define _IOERR
Definition: stdio.h:19
#define MSVCRT_CHECK_PMT(x)
Definition: msvcrt.h:378
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
Definition: fci.c:127

Referenced by _rmtmp(), common_freopen(), and fclose().

◆ _fcloseall()

_ACRTIMP int __cdecl _fcloseall ( void  )

Definition at line 1373 of file file.c.

1374{
1375 int num_closed = 0, i;
1376 FILE *file;
1377
1378 LOCK_FILES();
1379 for (i = 3; i < MSVCRT_stream_idx; i++) {
1381
1382 if (file->_flag && !fclose(file))
1383 num_closed++;
1384 }
1385 UNLOCK_FILES();
1386
1387 TRACE(":closed (%d) handles\n",num_closed);
1388 return num_closed;
1389}
#define LOCK_FILES()
Definition: file.c:306
int CDECL fclose(FILE *file)
Definition: file.c:3757
#define UNLOCK_FILES()
Definition: file.c:307
static FILE * msvcrt_get_file(int i)
Definition: file.c:520
static int MSVCRT_stream_idx
Definition: file.c:279
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define TRACE(s)
Definition: solgame.cpp:4

◆ _fdopen()

_ACRTIMP FILE *__cdecl _fdopen ( int  fd,
const char mode 
)

Definition at line 1847 of file file.c.

1848{
1849 FILE *ret;
1850 wchar_t *modeW = NULL;
1851
1852 if (mode && !(modeW = msvcrt_wstrdupa(mode))) return NULL;
1853
1854 ret = _wfdopen(fd, modeW);
1855
1856 free(modeW);
1857 return ret;
1858}
wchar_t * msvcrt_wstrdupa(const char *str)
Definition: data.c:373
FILE *CDECL _wfdopen(int fd, const wchar_t *mode)
Definition: file.c:1863
return ret
Definition: mutex.c:146
GLenum mode
Definition: glext.h:6217
static int fd
Definition: io.c:51

Referenced by _tWinMain(), ConStreamSetOSHandle(), fdopen(), and FTPRebuildConnectionInfo().

◆ _fflush_nolock()

_ACRTIMP int __cdecl _fflush_nolock ( FILE file)

Definition at line 1201 of file file.c.

1202{
1203 int res;
1204
1205 if(!file) {
1207 return 0;
1208 }
1209
1211 if(!res && (file->_flag & MSVCRT__IOCOMMIT))
1212 res = _commit(file->_file) ? EOF : 0;
1213 return res;
1214}
int CDECL _commit(int fd)
Definition: file.c:1112
static int msvcrt_flush_buffer(FILE *file)
Definition: file.c:835
static int msvcrt_flush_all_buffers(int mask)
Definition: file.c:1148
#define MSVCRT__IOCOMMIT
Definition: msvcrt.h:337
GLuint res
Definition: glext.h:9613

Referenced by _fclose_nolock(), common_flush_all(), fflush(), and setvbuf().

◆ _fgetc_nolock()

_ACRTIMP int __cdecl _fgetc_nolock ( FILE file)

Definition at line 3877 of file file.c.

3878{
3879 unsigned char *i;
3880 unsigned int j;
3881
3882 if (file->_cnt>0) {
3883 file->_cnt--;
3884 i = (unsigned char *)file->_ptr++;
3885 j = *i;
3886 } else
3887 j = _filbuf(file);
3888
3889 return j;
3890}
int CDECL _filbuf(FILE *file)
Definition: file.c:3819
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250

◆ _fgetchar()

_ACRTIMP int __cdecl _fgetchar ( void  )

Definition at line 3895 of file file.c.

3896{
3897 return fgetc(stdin);
3898}
int CDECL fgetc(FILE *file)
Definition: file.c:3863
#define stdin

Referenced by fgetchar().

◆ _filbuf()

_ACRTIMP int __cdecl _filbuf ( FILE file)

Definition at line 3819 of file file.c.

3820{
3821 unsigned char c;
3822
3823 if(file->_flag & _IOSTRG)
3824 return EOF;
3825
3826 /* Allocate buffer if needed */
3827 if(!(file->_flag & (MSVCRT__NOBUF | _IOMYBUF | MSVCRT__USERBUF)))
3829
3830 if(!(file->_flag & _IOREAD)) {
3831 if(file->_flag & _IORW)
3832 file->_flag |= _IOREAD;
3833 else
3834 return EOF;
3835 }
3836
3837 if(!(file->_flag & (_IOMYBUF | MSVCRT__USERBUF))) {
3838 int r;
3839 if ((r = _read(file->_file,&c,1)) != 1) {
3840 file->_flag |= (r == 0) ? _IOEOF : _IOERR;
3841 return EOF;
3842 }
3843
3844 return c;
3845 } else {
3846 file->_cnt = _read(file->_file, file->_base, file->_bufsiz);
3847 if(file->_cnt<=0) {
3848 file->_flag |= (file->_cnt == 0) ? _IOEOF : _IOERR;
3849 file->_cnt = 0;
3850 return EOF;
3851 }
3852
3853 file->_cnt--;
3854 file->_ptr = file->_base+1;
3855 c = *(unsigned char *)file->_base;
3856 return c;
3857 }
3858}
int CDECL _read(int fd, void *buf, unsigned int count)
Definition: file.c:3127
static BOOL msvcrt_alloc_buffer(FILE *file)
Definition: file.c:866
#define _IOEOF
Definition: stdio.h:18
#define _IOSTRG
Definition: stdio.h:20
#define MSVCRT__NOBUF
Definition: msvcrt.h:51
#define MSVCRT__USERBUF
Definition: msvcrt.h:336
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80

Referenced by _fgetc_nolock(), fgetc(), and test_filbuf().

◆ _fileno()

◆ _flsbuf()

_ACRTIMP int __cdecl _flsbuf ( int  c,
FILE file 
)

Definition at line 4075 of file file.c.

4076{
4077 /* Flush output buffer */
4078 if(!(file->_flag & (MSVCRT__NOBUF | _IOMYBUF | MSVCRT__USERBUF))) {
4080 }
4081
4082 if(!(file->_flag & _IOWRT)) {
4083 if(!(file->_flag & _IORW)) {
4084 file->_flag |= _IOERR;
4085 *_errno() = EBADF;
4086 return EOF;
4087 }
4088 file->_flag |= _IOWRT;
4089 }
4090 if(file->_flag & _IOREAD) {
4091 if(!(file->_flag & _IOEOF)) {
4092 file->_flag |= _IOERR;
4093 return EOF;
4094 }
4095 file->_cnt = 0;
4096 file->_ptr = file->_base;
4097 file->_flag &= ~(_IOREAD | _IOEOF);
4098 }
4099
4100 if(file->_flag & (_IOMYBUF | MSVCRT__USERBUF)) {
4101 int res = 0;
4102
4103 if(file->_cnt <= 0) {
4105 if(res)
4106 return res;
4107 file->_flag |= _IOWRT;
4108 file->_cnt=file->_bufsiz;
4109 }
4110 *file->_ptr++ = c;
4111 file->_cnt--;
4112 return c&0xff;
4113 } else {
4114 unsigned char cc=c;
4115 int len;
4116 /* set _cnt to 0 for unbuffered FILEs */
4117 file->_cnt = 0;
4118 len = _write(file->_file, &cc, 1);
4119 if (len == 1)
4120 return c & 0xff;
4121 file->_flag |= _IOERR;
4122 return EOF;
4123 }
4124}
int *CDECL _errno(void)
Definition: errno.c:215
int CDECL _write(int fd, const void *buf, unsigned int count)
Definition: file.c:3561
#define EBADF
Definition: errno.h:32
GLenum GLsizei len
Definition: glext.h:6722
uint32_t cc
Definition: isohybrid.c:75

◆ _flushall()

_ACRTIMP int __cdecl _flushall ( void  )

Definition at line 1174 of file file.c.

1175{
1177}

◆ _fputc_nolock()

_ACRTIMP int __cdecl _fputc_nolock ( int  c,
FILE file 
)

Definition at line 4374 of file file.c.

4375{
4376 int res;
4377
4378 if(file->_cnt>0) {
4379 *file->_ptr++=c;
4380 file->_cnt--;
4381 if (c == '\n')
4382 {
4384 return res ? res : c;
4385 }
4386 else {
4387 return c & 0xff;
4388 }
4389 } else {
4390 res = _flsbuf(c, file);
4391 return res;
4392 }
4393}
#define _flsbuf
Definition: _flswbuf.c:10

◆ _fputchar()

_ACRTIMP int __cdecl _fputchar ( int  c)

Definition at line 4398 of file file.c.

4399{
4400 return fputc(c, stdout);
4401}
int CDECL fputc(int c, FILE *file)
Definition: file.c:4360
#define stdout

Referenced by fputchar(), and putchar().

◆ _fread_nolock()

_ACRTIMP size_t __cdecl _fread_nolock ( void ptr,
size_t  size,
size_t  nmemb,
FILE file 
)

Definition at line 4420 of file file.c.

4421{
4422 size_t rcnt=size * nmemb;
4423 size_t read=0;
4424 size_t pread=0;
4425
4426 if(!rcnt)
4427 return 0;
4428
4429 /* first buffered data */
4430 if(file->_cnt>0) {
4431 int pcnt= (rcnt>file->_cnt)? file->_cnt:rcnt;
4432 memcpy(ptr, file->_ptr, pcnt);
4433 file->_cnt -= pcnt;
4434 file->_ptr += pcnt;
4435 read += pcnt ;
4436 rcnt -= pcnt ;
4437 ptr = (char*)ptr + pcnt;
4438 } else if(!(file->_flag & _IOREAD )) {
4439 if(file->_flag & _IORW) {
4440 file->_flag |= _IOREAD;
4441 } else {
4442 return 0;
4443 }
4444 }
4445
4446 if(rcnt>0 && !(file->_flag & (MSVCRT__NOBUF | _IOMYBUF | MSVCRT__USERBUF)))
4448
4449 while(rcnt>0)
4450 {
4451 int i;
4452 if (!file->_cnt && rcnt<file->_bufsiz && (file->_flag & (_IOMYBUF | MSVCRT__USERBUF))) {
4453 i = _read(file->_file, file->_base, file->_bufsiz);
4454 file->_ptr = file->_base;
4455 if (i != -1) {
4456 file->_cnt = i;
4457 if (i > rcnt) i = rcnt;
4458 }
4459 /* If the buffer fill reaches eof but fread wouldn't, clear eof. */
4460 if (i > 0 && i < file->_cnt) {
4461 get_ioinfo_nolock(file->_file)->wxflag &= ~WX_ATEOF;
4462 file->_flag &= ~_IOEOF;
4463 }
4464 if (i > 0) {
4465 memcpy(ptr, file->_ptr, i);
4466 file->_cnt -= i;
4467 file->_ptr += i;
4468 }
4469 } else if (rcnt > INT_MAX) {
4470 i = _read(file->_file, ptr, INT_MAX);
4471 } else if (rcnt < (file->_bufsiz ? file->_bufsiz : MSVCRT_INTERNAL_BUFSIZ)) {
4472 i = _read(file->_file, ptr, rcnt);
4473 } else {
4474 i = _read(file->_file, ptr, rcnt - rcnt % (file->_bufsiz ? file->_bufsiz : MSVCRT_INTERNAL_BUFSIZ));
4475 }
4476 pread += i;
4477 rcnt -= i;
4478 ptr = (char *)ptr+i;
4479 /* expose feof condition in the flags
4480 * MFC tests file->_flag for feof, and doesn't call feof())
4481 */
4482 if (get_ioinfo_nolock(file->_file)->wxflag & WX_ATEOF)
4483 file->_flag |= _IOEOF;
4484 else if (i == -1)
4485 {
4486 file->_flag |= _IOERR;
4487 pread = 0;
4488 rcnt = 0;
4489 }
4490 if (i < 1) break;
4491 }
4492 read+=pread;
4493 return read / size;
4494}
#define read
Definition: acwin.h:96
#define WX_ATEOF
Definition: file.c:81
static ioinfo * get_ioinfo_nolock(int fd)
Definition: file.c:394
#define MSVCRT_INTERNAL_BUFSIZ
Definition: file.c:92
#define INT_MAX
Definition: limits.h:26
GLsizeiptr size
Definition: glext.h:5919
if(dx< 0)
Definition: linetemp.h:194
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PVOID ptr
Definition: dispmode.c:27
ssize_t pread(int fd, void *buf, size_t count, off_t offset)
unsigned char wxflag
Definition: file.c:130

Referenced by fread().

◆ _fread_nolock_s()

_ACRTIMP size_t __cdecl _fread_nolock_s ( void buffer,
size_t  buffer_size,
size_t  element_size,
size_t  element_count,
FILE public_stream 
)

Definition at line 69 of file fread.cpp.

76{
77 __crt_stdio_stream const stream(public_stream);
78
79 if (element_size == 0 || element_count == 0)
80 return 0;
81
82 _VALIDATE_RETURN(buffer != nullptr, EINVAL, 0);
83 if (!stream.valid() || element_count > (SIZE_MAX / element_size))
84 {
87
88 _VALIDATE_RETURN(stream.valid(), EINVAL, 0);
89 _VALIDATE_RETURN(element_count <= (SIZE_MAX / element_size), EINVAL, 0);
90 }
91
92 // Figure out how big the buffer is; if the stream doesn't currently have a
93 // buffer, we assume that we'll get one with the usual internal buffer size:
94 unsigned stream_buffer_size = stream.has_any_buffer()
95 ? stream->_bufsiz
97
98 // The total number of bytes to be read into the buffer:
99 size_t const total_bytes = element_size * element_count;
100
101 char* data = static_cast<char*>(buffer);
102
103 // Read blocks of data from the stream until we have read the requested
104 // number of elements or we fill the buffer.
105 size_t remaining_bytes = total_bytes;
106 size_t remaining_buffer = buffer_size;
107 while (remaining_bytes != 0)
108 {
109 // If the stream is buffered and has characters, copy them into the
110 // result buffer:
111 if (stream.has_any_buffer() && stream->_cnt != 0)
112 {
113 if(stream->_cnt < 0)
114 {
115 _ASSERTE(("Inconsistent Stream Count. Flush between consecutive read and write", stream->_cnt >= 0));
116 stream.set_flags(_IOERROR);
117 return (total_bytes - remaining_bytes) / element_size;
118 }
119
120 unsigned const bytes_to_read = remaining_bytes < static_cast<size_t>(stream->_cnt)
121 ? static_cast<unsigned>(remaining_bytes)
122 : static_cast<unsigned>(stream->_cnt);
123
124 if (bytes_to_read > remaining_buffer)
125 {
128
129 _VALIDATE_RETURN(("buffer too small", 0), ERANGE, 0)
130 }
131
132 memcpy_s(data, remaining_buffer, stream->_ptr, bytes_to_read);
133
134 // Update the stream and local tracking variables to account for the
135 // read. Note that the number of bytes actually read is always equal
136 // to the number of bytes that we expected to read, because the data
137 // was already buffered in the stream.
138 remaining_bytes -= bytes_to_read;
139 stream->_cnt -= bytes_to_read;
140 stream->_ptr += bytes_to_read;
141 data += bytes_to_read;
142 remaining_buffer -= bytes_to_read;
143 }
144 // There is no data remaining in the stream buffer to be read, and we
145 // need to read more data than will fit in the buffer (or we need to read
146 // at least enough data to fill the buffer completely):
147 else if (remaining_bytes >= stream_buffer_size)
148 {
149 // We can read at most INT_MAX bytes at a time. This is a hard limit
150 // of the lowio _read() function.
151 unsigned const maximum_bytes_to_read = remaining_bytes > INT_MAX
152 ? static_cast<unsigned>(INT_MAX)
153 : static_cast<unsigned>(remaining_bytes);
154
155 // If the stream has a buffer, we want to read the largest chunk that
156 // is a multiple of the buffer size, to keep the stream buffer state
157 // consistent. If the stream is not buffered, we can read the maximum
158 // number of bytes that we can:
159 unsigned const bytes_to_read = stream_buffer_size != 0
160 ? static_cast<unsigned>(maximum_bytes_to_read - maximum_bytes_to_read % stream_buffer_size)
161 : maximum_bytes_to_read;
162
163 if (bytes_to_read > remaining_buffer)
164 {
167
168 _VALIDATE_RETURN(("buffer too small", 0), ERANGE, 0)
169 }
170
171 // We are about to read data directly from the underlying file
172 // descriptor, bypassing the stream buffer. We reset the stream
173 // buffer state to ensure that future seeks do not incorrectly
174 // assume that the buffer contents are valid.
176
177 // Do the read. Note that if the stream is open in text mode, the
178 // bytes_read may not be the same as the bytes_to_read, due to
179 // newline translation.
180 int const bytes_read = _read_nolock(_fileno(stream.public_stream()), data, bytes_to_read);
181 if (bytes_read == 0)
182 {
183 // We encountered EOF:
184 stream.set_flags(_IOEOF);
185 return (total_bytes - remaining_bytes) / element_size;
186 }
187 else if (bytes_read < 0)
188 {
189 // The _read failed:
190 stream.set_flags(_IOERROR);
191 return (total_bytes - remaining_bytes) / element_size;
192 }
193
194 // Update the iteration state to reflect the read:
195 remaining_bytes -= bytes_read;
196 data += bytes_read;
197 remaining_buffer -= bytes_read;
198 }
199 // Otherwise, the stream does not have a buffer, or the stream buffer
200 // is full and there is insufficient space to do a direct read, so use
201 // __acrt_stdio_refill_and_read_narrow_nolock:
202 else
203 {
204 int const c = __acrt_stdio_refill_and_read_narrow_nolock(stream.public_stream());
205 if (c == EOF)
206 return (total_bytes - remaining_bytes) / element_size;
207
208 // If we have filled the result buffer before we have read the
209 // requested number of elements or reached EOF, it is an error:
210 if (remaining_buffer == 0)
211 {
214
215 _VALIDATE_RETURN(("buffer too small", 0), ERANGE, 0)
216 }
217
218 *data++ = static_cast<char>(c);
219 --remaining_bytes;
220 --remaining_buffer;
221
222 stream_buffer_size = stream->_bufsiz;
223 }
224 }
225
226 return element_count; // Success!
227}
int __cdecl __acrt_stdio_refill_and_read_narrow_nolock(FILE *const stream)
Definition: _filbuf.cpp:178
#define _CRT_UNBOUNDED_BUFFER_SIZE
#define _INTERNAL_BUFSIZ
void __cdecl __acrt_stdio_reset_buffer(__crt_stdio_stream const stream)
#define _VALIDATE_RETURN(expr, errorcode, retexpr)
size_t const element_size
Definition: debug_heap.cpp:510
int CDECL _fileno(FILE *file)
Definition: file.c:1925
int CDECL memcpy_s(void *dest, size_t numberOfElements, const void *src, size_t count)
Definition: heap.c:779
#define _ASSERTE(expr)
Definition: crtdbg.h:57
#define EINVAL
Definition: errno.h:44
#define ERANGE
Definition: errno.h:55
#define SIZE_MAX
Definition: limits.h:49
#define _BUFFER_FILL_PATTERN
Definition: fread.cpp:14
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint buffer
Definition: glext.h:5915
#define memset(x, y, z)
Definition: compat.h:39
int __cdecl _read_nolock(int const fh, void *const result_buffer, unsigned const result_buffer_size)
Definition: read.cpp:408
wchar_t const *const size_t const buffer_size
Definition: stat.cpp:95
Definition: parse.h:23

Referenced by _fread_nolock(), and fread_s().

◆ _fseek_nolock()

_ACRTIMP int __cdecl _fseek_nolock ( FILE file,
__msvcrt_long  offset,
int  whence 
)

Definition at line 1618 of file file.c.

1619{
1620 return _fseeki64_nolock( file, offset, whence );
1621}
int CDECL _fseeki64_nolock(FILE *file, __int64 offset, int whence)
Definition: file.c:1585
GLintptr offset
Definition: glext.h:5920

Referenced by rewind().

◆ _fseeki64()

_ACRTIMP int __cdecl _fseeki64 ( FILE file,
__int64  offset,
int  whence 
)

Definition at line 1571 of file file.c.

1572{
1573 int ret;
1574
1576 ret = _fseeki64_nolock(file, offset, whence);
1578
1579 return ret;
1580}
void CDECL _lock_file(FILE *file)
Definition: file.c:1487
void CDECL _unlock_file(FILE *file)
Definition: file.c:1499

Referenced by fseek(), and fsetpos().

◆ _fseeki64_nolock()

_ACRTIMP int __cdecl _fseeki64_nolock ( FILE file,
__int64  offset,
int  whence 
)

Definition at line 1585 of file file.c.

1586{
1587 int ret;
1588
1589 if(whence == SEEK_CUR && file->_flag & _IOREAD ) {
1590 whence = SEEK_SET;
1592 }
1593
1594 /* Flush output if needed */
1596 /* Reset direction of i/o */
1597 if(file->_flag & _IORW) {
1598 file->_flag &= ~(_IOREAD|_IOWRT);
1599 }
1600 /* Clear end of file flag */
1601 file->_flag &= ~_IOEOF;
1602 ret = (_lseeki64(file->_file,offset,whence) == -1)?-1:0;
1603
1604 return ret;
1605}
__int64 CDECL _lseeki64(int fd, __int64 offset, int whence)
Definition: file.c:1432
__int64 CDECL _ftelli64_nolock(FILE *file)
Definition: file.c:4686
#define SEEK_CUR
Definition: stdio.h:44
#define SEEK_SET
Definition: jmemansi.c:26

Referenced by _fseek_nolock(), and _fseeki64().

◆ _fsopen()

_ACRTIMP FILE *__cdecl _fsopen ( const char path,
const char mode,
int  share 
)

Definition at line 4288 of file file.c.

4289{
4290 wchar_t *pathW = NULL, *modeW = NULL;
4291 FILE *ret;
4292
4293 if (path && !(pathW = wstrdupa_utf8(path))) return NULL;
4294 if (mode && !(modeW = wstrdupa_utf8(mode)))
4295 {
4296 free(pathW);
4297 return NULL;
4298 }
4299
4300 ret = _wfsopen(pathW, modeW, share);
4301
4302 free(pathW);
4303 free(modeW);
4304 return ret;
4305}
FILE *CDECL _wfsopen(const wchar_t *path, const wchar_t *mode, int share)
Definition: file.c:4254
static wchar_t * wstrdupa_utf8(const char *str)
Definition: msvcrt.h:440

Referenced by fopen(), and test_fopen().

◆ _ftell_nolock()

_ACRTIMP __msvcrt_long __cdecl _ftell_nolock ( FILE public_stream)

Definition at line 379 of file ftell.cpp.

380{
381 __crt_cached_ptd_host ptd;
382 return common_ftell_nolock<long>(__crt_stdio_stream(public_stream), ptd);
383}
_In_ size_t const _In_ int _In_ bool const _In_ unsigned const _In_ __acrt_rounding_mode const _Inout_ __crt_cached_ptd_host & ptd
Definition: cvt.cpp:355

◆ _ftelli64()

_ACRTIMP __int64 __cdecl _ftelli64 ( FILE file)

Definition at line 4672 of file file.c.

4673{
4674 __int64 ret;
4675
4679
4680 return ret;
4681}
#define __int64
Definition: corecrt.h:72

Referenced by _fseeki64(), fgetpos(), and ftell().

◆ _ftelli64_nolock()

_ACRTIMP __int64 __cdecl _ftelli64_nolock ( FILE file)

Definition at line 4686 of file file.c.

4687{
4688 __int64 pos;
4689
4690 pos = _telli64(file->_file);
4691 if(pos == -1)
4692 return -1;
4693 if(file->_flag & (_IOMYBUF | MSVCRT__USERBUF)) {
4694 if(file->_flag & _IOWRT) {
4695 pos += file->_ptr - file->_base;
4696
4697 if(get_ioinfo_nolock(file->_file)->wxflag & WX_TEXT) {
4698 char *p;
4699
4700 for(p=file->_base; p<file->_ptr; p++)
4701 if(*p == '\n')
4702 pos++;
4703 }
4704 } else if(!file->_cnt) { /* nothing to do */
4705 } else if(_lseeki64(file->_file, 0, SEEK_END)==pos) {
4706 int i;
4707
4708 pos -= file->_cnt;
4709 if(get_ioinfo_nolock(file->_file)->wxflag & WX_TEXT) {
4710 for(i=0; i<file->_cnt; i++)
4711 if(file->_ptr[i] == '\n')
4712 pos--;
4713 }
4714 } else {
4715 char *p;
4716
4717 if(_lseeki64(file->_file, pos, SEEK_SET) != pos)
4718 return -1;
4719
4720 pos -= file->_bufsiz;
4721 pos += file->_ptr - file->_base;
4722
4723 if(get_ioinfo_nolock(file->_file)->wxflag & WX_TEXT) {
4724 if(get_ioinfo_nolock(file->_file)->wxflag & WX_READNL)
4725 pos--;
4726
4727 for(p=file->_base; p<file->_ptr; p++)
4728 if(*p == '\n')
4729 pos++;
4730 }
4731 }
4732 }
4733
4734 return pos;
4735}
#define SEEK_END
Definition: cabinet.c:29
#define WX_READNL
Definition: file.c:82
__int64 CDECL _telli64(int fd)
Definition: file.c:3433
#define WX_TEXT
Definition: file.c:87
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by _fseeki64_nolock(), and _ftelli64().

◆ _fwrite_nolock()

_ACRTIMP size_t __cdecl _fwrite_nolock ( const void ptr,
size_t  size,
size_t  nmemb,
FILE file 
)

Definition at line 4143 of file file.c.

4144{
4145 size_t wrcnt=size * nmemb;
4146 int written = 0;
4147 if (size == 0)
4148 return 0;
4149
4150 while(wrcnt) {
4151 if(file->_cnt < 0) {
4152 WARN("negative file->_cnt value in %p\n", file);
4153 file->_flag |= _IOERR;
4154 break;
4155 } else if(file->_cnt) {
4156 int pcnt=(file->_cnt>wrcnt)? wrcnt: file->_cnt;
4157 memcpy(file->_ptr, ptr, pcnt);
4158 file->_cnt -= pcnt;
4159 file->_ptr += pcnt;
4160 written += pcnt;
4161 wrcnt -= pcnt;
4162 ptr = (const char*)ptr + pcnt;
4163 } else if((file->_flag & MSVCRT__NOBUF)
4164 || ((file->_flag & (_IOMYBUF | MSVCRT__USERBUF)) && wrcnt >= file->_bufsiz)
4165 || (!(file->_flag & (_IOMYBUF | MSVCRT__USERBUF)) && wrcnt >= MSVCRT_INTERNAL_BUFSIZ)) {
4166 size_t pcnt;
4167 int bufsiz;
4168
4169 if(file->_flag & MSVCRT__NOBUF)
4170 bufsiz = 1;
4171 else if(!(file->_flag & (_IOMYBUF | MSVCRT__USERBUF)))
4172 bufsiz = MSVCRT_INTERNAL_BUFSIZ;
4173 else
4174 bufsiz = file->_bufsiz;
4175
4176 pcnt = (wrcnt / bufsiz) * bufsiz;
4177
4179 break;
4180
4181 if(_write(file->_file, ptr, pcnt) <= 0) {
4182 file->_flag |= _IOERR;
4183 break;
4184 }
4185 written += pcnt;
4186 wrcnt -= pcnt;
4187 ptr = (const char*)ptr + pcnt;
4188 } else {
4189 if(_flsbuf(*(const char*)ptr, file) == EOF)
4190 break;
4191 written++;
4192 wrcnt--;
4193 ptr = (const char*)ptr + 1;
4194 }
4195 }
4196
4197 return written / size;
4198}
#define WARN(fmt,...)
Definition: precomp.h:61

Referenced by _fputwc_nolock(), fputs(), fputws(), fwrite(), puts(), and puts_clbk_file_w().

◆ _get_output_format()

_ACRTIMP unsigned int __cdecl _get_output_format ( void  )

Definition at line 401 of file misc.c.

402{
403 return output_format;
404}
static unsigned int output_format
Definition: misc.c:32

Referenced by pf_printf().

◆ _get_printf_count_output()

_ACRTIMP int __cdecl _get_printf_count_output ( void  )

Definition at line 5 of file stubs.c.

6{
7 return n_format_enabled ? 1 : 0;
8}
static BOOL n_format_enabled
Definition: stubs.c:3

Referenced by __crt_stdio_output::output_processor< Character, OutputAdapter, ProcessorBase >::type_case_n().

◆ _getc_nolock()

_ACRTIMP int __cdecl _getc_nolock ( FILE stream)

Definition at line 32 of file fgetc.cpp.

33{
34 return _fgetc_nolock(stream);
35}
#define _fgetc_nolock(_stream)
Definition: stdio.h:1142

◆ _getmaxstdio()

_ACRTIMP int __cdecl _getmaxstdio ( void  )

Definition at line 5862 of file file.c.

5863{
5864 return MSVCRT_max_streams;
5865}
static int MSVCRT_max_streams
Definition: file.c:279

◆ _getw()

_ACRTIMP int __cdecl _getw ( FILE file)

Definition at line 3994 of file file.c.

3995{
3996 char *ch;
3997 int i, k;
3998 unsigned int j;
3999 ch = (char *)&i;
4000
4002 for (j=0; j<sizeof(int); j++) {
4003 k = _fgetc_nolock(file);
4004 if (k == EOF) {
4005 file->_flag |= _IOEOF;
4007 return EOF;
4008 }
4009 ch[j] = k;
4010 }
4011
4013 return i;
4014}
unsigned char ch[4][2]
Definition: console.c:118
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
int k
Definition: mpi.c:3369

Referenced by getw(), and test_readmode().

◆ _lock_file()

◆ _pclose()

_ACRTIMP int __cdecl _pclose ( FILE file)

Definition at line 1212 of file process.c.

1213{
1214 HANDLE h;
1215 DWORD i;
1216
1217 if (!MSVCRT_CHECK_PMT(file != NULL)) return -1;
1218
1220 for(i=0; i<popen_handles_size; i++)
1221 {
1222 if (popen_handles[i].f == file)
1223 break;
1224 }
1225 if(i == popen_handles_size)
1226 {
1228 *_errno() = EBADF;
1229 return -1;
1230 }
1231
1232 h = popen_handles[i].proc;
1233 popen_handles[i].f = NULL;
1235
1236 fclose(file);
1238 {
1240 CloseHandle(h);
1241 return -1;
1242 }
1243
1244 CloseHandle(h);
1245 return i;
1246}
#define CloseHandle
Definition: compat.h:739
BOOL WINAPI GetExitCodeProcess(IN HANDLE hProcess, IN LPDWORD lpExitCode)
Definition: proc.c:1168
void CDECL _unlock(int locknum)
Definition: lock.c:114
#define _POPEN_LOCK
Definition: mtdll.h:40
static DWORD popen_handles_size
Definition: process.c:1032
static struct popen_handle * popen_handles
#define INFINITE
Definition: serial.h:102
unsigned long DWORD
Definition: ntddk_ex.h:95
GLfloat f
Definition: glext.h:7540
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define msvcrt_set_errno
Definition: heap.c:50
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define WAIT_FAILED
Definition: winbase.h:390

Referenced by _tmain(), ForF(), pclose(), recvrequest(), sendrequest(), test__popen(), and Test_popen().

◆ _popen()

_ACRTIMP FILE *__cdecl _popen ( const char command,
const char mode 
)

Definition at line 1185 of file process.c.

1186{
1187 FILE *ret;
1188 wchar_t *cmdW, *modeW;
1189
1190 TRACE("(command=%s, mode=%s)\n", debugstr_a(command), debugstr_a(mode));
1191
1192 if (!command || !mode)
1193 return NULL;
1194
1195 if (!(cmdW = wstrdupa_utf8(command))) return NULL;
1196 if (!(modeW = msvcrt_wstrdupa(mode)))
1197 {
1198 free(cmdW);
1199 return NULL;
1200 }
1201
1202 ret = _wpopen(cmdW, modeW);
1203
1204 free(cmdW);
1205 free(modeW);
1206 return ret;
1207}
FILE *CDECL _wpopen(const wchar_t *command, const wchar_t *mode)
Definition: process.c:1044
#define debugstr_a
Definition: kernel32.h:31

Referenced by _tmain(), popen(), recvrequest(), sendrequest(), test__popen(), and Test_popen().

◆ _putc_nolock()

_ACRTIMP int __cdecl _putc_nolock ( int  c,
FILE stream 
)

Definition at line 37 of file fputc.cpp.

38{
39 return _fputc_nolock(c, stream);
40}
#define _fputc_nolock(_c, _stream)
Definition: stdio.h:1143

◆ _putw()

_ACRTIMP int __cdecl _putw ( int  val,
FILE file 
)

Definition at line 3738 of file file.c.

3739{
3740 int len;
3741
3743 len = _write(file->_file, &val, sizeof(val));
3744 if (len == sizeof(val)) {
3746 return val;
3747 }
3748
3749 file->_flag |= _IOERR;
3751 return EOF;
3752}
GLuint GLfloat * val
Definition: glext.h:7180

Referenced by putw().

◆ _rmtmp()

_ACRTIMP int __cdecl _rmtmp ( void  )

Definition at line 2748 of file file.c.

2749{
2750 int num_removed = 0, i;
2751 FILE *file;
2752
2753 LOCK_FILES();
2754 for (i = 3; i < MSVCRT_stream_idx; i++) {
2756
2757 if (file->_tmpfname)
2758 {
2759 fclose(file);
2760 num_removed++;
2761 }
2762 }
2763 UNLOCK_FILES();
2764
2765 if (num_removed)
2766 TRACE(":removed (%d) temp files\n",num_removed);
2767 return num_removed;
2768}

◆ _scprintf()

_ACRTIMP int __cdecl _scprintf ( const char ,
  ... 
)

Referenced by _gcvt_s(), and HTTPREQ_QueryOption().

◆ _set_output_format()

_ACRTIMP unsigned int __cdecl _set_output_format ( unsigned int  new_output_format)

Definition at line 409 of file misc.c.

410{
411 unsigned int ret = output_format;
412
413 if(!MSVCRT_CHECK_PMT(new_output_format==0 || new_output_format==_TWO_DIGIT_EXPONENT))
414 return ret;
415
416 output_format = new_output_format;
417 return ret;
418}
#define _TWO_DIGIT_EXPONENT
Definition: stdio.h:68

◆ _set_printf_count_output()

_ACRTIMP int __cdecl _set_printf_count_output ( int  enable)

Definition at line 10 of file stubs.c.

11{
14 return old ? 1 : 0;
15}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
GLboolean enable
Definition: glext.h:11120

Referenced by DllMain().

◆ _setmaxstdio()

_ACRTIMP int __cdecl _setmaxstdio ( int  newmax)

Definition at line 5870 of file file.c.

5871{
5872 TRACE("%d\n", newmax);
5873
5874 if(newmax<_IOB_ENTRIES || newmax>MSVCRT_MAX_FILES || newmax<MSVCRT_stream_idx)
5875 return -1;
5876
5877 MSVCRT_max_streams = newmax;
5878 return MSVCRT_max_streams;
5879}
#define MSVCRT_MAX_FILES
Definition: file.c:125

◆ _snprintf()

static int __cdecl static int __cdecl _snprintf ( char buffer,
size_t  size,
const char format,
  ... 
)
inlinestatic

Definition at line 507 of file stdio.h.

508{
509 int ret;
511
514 va_end(args);
515 return ret;
516}
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
char * va_list
Definition: vadefs.h:50
#define args
Definition: format.c:66
Definition: match.c:390
Definition: format.c:58
#define _vsnprintf
Definition: xmlstorage.h:202

◆ _snprintf_s()

_ACRTIMP int __cdecl _ACRTIMP int __cdecl _snprintf_s ( char ,
size_t  ,
size_t  ,
const char ,
  ... 
)

Referenced by _VCrtDbgReportA().

◆ _snscanf_l()

_ACRTIMP int __cdecl _snscanf_l ( const char ,
size_t  ,
const char ,
_locale_t  ,
  ... 
)

◆ _sscanf_l()

_ACRTIMP int __cdecl _ACRTIMP int __cdecl _sscanf_l ( const char ,
const char ,
_locale_t  ,
  ... 
)

◆ _tempnam()

_ACRTIMP char *__cdecl _tempnam ( const char dir,
const char prefix 
)

Definition at line 3441 of file file.c.

3442{
3443 wchar_t *dirW = NULL, *prefixW = NULL, *retW;
3444 char *ret;
3445
3446 if (dir && !(dirW = wstrdupa_utf8(dir))) return NULL;
3447 if (prefix && !(prefixW = wstrdupa_utf8(prefix)))
3448 {
3449 free(dirW);
3450 return NULL;
3451 }
3452 retW = _wtempnam(dirW, prefixW);
3453 free(dirW);
3454 free(prefixW);
3455 /* TODO: don't do the conversion */
3456 ret = astrdupw_utf8(retW);
3457 free(retW);
3458 return ret;
3459}
unsigned int dir
Definition: maze.c:112
wchar_t *CDECL _wtempnam(const wchar_t *dir, const wchar_t *prefix)
Definition: file.c:3464
static char * astrdupw_utf8(const wchar_t *wstr)
Definition: msvcrt.h:452
Character const *const prefix
Definition: tempnam.cpp:195

Referenced by tempnam(), test__popen(), test__sopen_dispatch(), test__sopen_s(), test_chsize(), test_ctrlz(), test_fflush(), test_fgetc(), test_fgetwc(), test_file_put_get(), test_file_write_read(), test_flsbuf(), test_fputc(), test_iobuf_layout(), test_ioinfo_flags(), test_utf8(), test_write_flush(), and tmpfile().

◆ _ungetc_nolock()

_ACRTIMP int __cdecl _ungetc_nolock ( int  c,
FILE file 
)

Definition at line 5748 of file file.c.

5749{
5750 if(!MSVCRT_CHECK_PMT(file != NULL)) return EOF;
5751
5752 if (c == EOF || !(file->_flag&_IOREAD ||
5753 (file->_flag&_IORW && !(file->_flag&_IOWRT))))
5754 return EOF;
5755
5756 if((!(file->_flag & (MSVCRT__NOBUF | _IOMYBUF | MSVCRT__USERBUF))
5758 || (!file->_cnt && file->_ptr==file->_base))
5759 file->_ptr++;
5760
5761 if(file->_ptr>file->_base) {
5762 file->_ptr--;
5763 if(file->_flag & _IOSTRG) {
5764 if(*file->_ptr != c) {
5765 file->_ptr++;
5766 return EOF;
5767 }
5768 }else {
5769 *file->_ptr = c;
5770 }
5771 file->_cnt++;
5772 file->_flag &= ~(_IOERR | _IOEOF);
5773 file->_flag |= _IOREAD;
5774 return c;
5775 }
5776
5777 return EOF;
5778}

Referenced by _ungetwc_nolock(), and ungetc().

◆ _unlink()

_ACRTIMP int __cdecl _unlink ( const char path)

Definition at line 1085 of file file.c.

1086{
1087 wchar_t *pathW = NULL;
1088 int ret;
1089
1090 if (path && !(pathW = wstrdupa_utf8(path))) return -1;
1091 ret = _wunlink(pathW);
1092 free(pathW);
1093 return ret;
1094}
int CDECL _wunlink(const wchar_t *path)
Definition: file.c:1099

Referenced by remove(), test___getmainargs(), test___getmainargs_parent(), test__popen(), test__wfopen_s(), test_chsize(), test_fopen_fclose_fcloseall(), test_fopen_s(), test_fputwc(), test_get_osfhandle(), test_setmode(), test_unlink(), and unlink().

◆ _unlock_file()

◆ _vscprintf()

◆ _vsnprintf()

◆ _vsnprintf_s()

◆ _vsprintf_p_l()

◆ clearerr()

_ACRTIMP void __cdecl clearerr ( FILE file)

Definition at line 1672 of file file.c.

1673{
1674 TRACE(":file (%p) fd (%d)\n",file,file->_file);
1675
1677 file->_flag &= ~(_IOERR | _IOEOF);
1679}

Referenced by read_mbr_template(), rewind(), test_fileops(), and ungetc().

◆ clearerr_s()

_ACRTIMP errno_t __cdecl clearerr_s ( FILE file)

Definition at line 1684 of file file.c.

1685{
1686 TRACE(":file (%p)\n",file);
1687
1688 if (!MSVCRT_CHECK_PMT(file != NULL)) return EINVAL;
1689
1691 file->_flag &= ~(_IOERR | _IOEOF);
1693 return 0;
1694}

Referenced by clearerr().

◆ fclose()

_ACRTIMP int __cdecl fclose ( FILE file)

Definition at line 3757 of file file.c.

3758{
3759 int ret;
3760
3761 if (!MSVCRT_CHECK_PMT(file != NULL)) return EOF;
3762
3766
3767 return ret;
3768}
int CDECL _fclose_nolock(FILE *file)
Definition: file.c:3773

Referenced by __CloseHandle(), _fcloseall(), _Filebuf_base::_M_close(), _pclose(), _rmtmp(), _wfreopen(), _wpopen(), abort(), CCabinet::AddFile(), check_atari(), check_bitmap_data(), check_file_size(), check_for_files(), CheckForNewV3User(), checkSsiByFilelist(), cleanReq(), File::close(), CCabinet::Close(), anonymous_namespace{popen.cpp}::stream_traits::close(), close_backing_store(), close_file(), close_log_files(), close_merge_image(), CloseBookmarkFile(), CloseFile(), CloseTrace(), CCabinet::CommitDisk(), compare_export_(), compat_fclose(), concat_files(), config_load(), copy_file(), create_cache(), create_nls_file(), create_output_file(), create_sic(), CreateCaseDiff(), CreateSpecFile(), DbgHelpAddLineNumber(), CCFDATAStorage::Destroy(), disk_cleanup(), DllMain(), DoCreateTestFile(), DoEntry(), DoParsing(), DosBIOSInitialize(), DoTestEntry(), EndLog(), endnetconfig(), endrpcent(), errconfig(), export_all(), export_key(), export_registry_key(), ExportBinaryHive(), extract_test(), CCabinet::ExtractFile(), fclose_file_func(), file_exists(), fileClient(), FileExists(), ForF(), gen_add_list(), Generate(), generate_xa_rr_attributes(), get_file_data(), get_ImageBase(), get_list_blocks(), get_subtests(), GetHostnameFromCommand(), getICMPStats(), getnetconfigent(), getnetid(), GetOurHostName(), getpublicandprivatekey(), getSection(), gl_check_inputrc_for_vi(), gl_histloadfile(), gl_histsavefile(), import_certs_from_file(), ImportRegistryFile(), InfHostOpenFile(), InfHostWriteFile(), init(), init_leases_list(), init_logger_addr(), TScript::initScript(), kbd_c(), kbd_def(), kbd_h(), kbd_rc(), CDFParser::Load(), Load_CP2Unicode_Table(), load_file(), Load_OEM2Unicode_Table(), LoadBootIni(), tinyxml2::XMLDocument::LoadFile(), LoadFile(), LoadFirewallPrefs(), LoadIniFile(), LoadPrefs(), LoadSystemIni(), log_file(), logMess(), LogOpen(), LogXfer(), lwip_fuzztest(), main(), MainWndProc(), myClose(), of_help(), open_input_file(), OpenBookmarkFile(), openSection(), OpenTmpBookmarkFile(), parse_switches(), parseAndPrintFile(), TANSIParser::ParseEscapeANSI(), PerformRegAction(), TANSIParser::PrintBuffer(), processRequest(), PutBookmark(), read_cache(), read_file(), read_input_file(), read_JPEG_file(), read_mbr_template(), read_quant_tables(), read_rcfile(), readAllPolygons(), readconfig(), ReadFromFile(), ReadHostsFile(), readSection(), recvrequest(), reg_import(), remglob(), ResourceToFile(), ResourceToFileW(), RunBookmarkEditor(), RunScript(), ruserpass(), tinyxml2::XMLDocument::SaveFile(), SavePrefs(), SdbCloseDatabase(), select_file_name(), send_file(), sendrequest(), ServiceMain(), set_LogFile(), CCabinet::SetCabinetReservedFile(), SHPropertyBag_OnIniFile(), SpoolX(), START_TEST(), FstreamTest::tellp(), test___getmainargs(), test___getmainargs_parent(), test__wfopen_s(), test_asciimode(), test_asciimode2(), test_ctrlz(), Test_DelNodeA(), Test_DelNodeW(), test_fdopen(), test_fflush(), test_fgetc(), test_fgetwc(), test_fgetwc_locale(), test_fgetwc_unicode(), test_filbuf(), test_file_put_get(), test_file_truncate(), test_filemodeT(), test_fileops(), test_flsbuf(), test_fopen(), test_fopen_exclusive(), test_fopen_fclose_fcloseall(), test_fopen_hints(), test_fopen_s(), test_fprintf(), test_fputc(), test_fputwc(), test_freopen(), test_fscanf(), test_fwprintf(), test_invalid_stdin_child(), test_iobuf_layout(), Test_PathProcessCommand(), test_pipes(), test_readboundary(), test_readmode(), test_searchenv(), TEST_Start(), test_std_stream_open(), test_unlink(), test_utf8(), test_write_flush(), CCFDATAStorage::Truncate(), txt_export_all(), txt_export_key(), unpack_iso(), verify_output_file(), wmain(), wpp_parse(), write_casemap_file(), write_client(), write_dlldata(), write_dlldata_list(), write_header(), write_id_data(), write_if_change(), write_JPEG_file(), write_local_stubs(), write_one_file(), write_proxies(), write_regscript(), write_server(), directedLine::writeAllPolygons(), CCabinet::WriteFileToScratchStorage(), WriteIniFile(), XCOPY_ProcessExcludeFile(), xkeymap_from_locale(), xkeymap_read(), xmlMemDisplay(), xmlMemDisplayLast(), xmlMemoryDump(), xsltDocumentElem(), CDFParser::~CDFParser(), FileReporter::~FileReporter(), and TANSIParser::~TANSIParser().

◆ fdopen()

◆ feof()

◆ ferror()

◆ fflush()

_ACRTIMP int __cdecl fflush ( FILE file)

Definition at line 1182 of file file.c.

1183{
1184 int ret;
1185
1186 if(!file) {
1188 ret = 0;
1189 } else {
1193 }
1194
1195 return ret;
1196}

Referenced by alarm_intr(), cd(), cdup(), check_blocks(), cmdabort(), cmdscanner(), CmpFileFlush(), command(), confirm(), dataconn(), delete(), disk_ioctl(), do_chmod(), domacro(), domap(), doproxy(), dprintf(), eprintf(), Error(), fclose(), fsetmode(), get_key(), GetCmd(), getit(), GetPass(), getreply(), globulize(), help(), hookup(), initconn(), InputChar(), InteractiveConsole(), lcd(), LocalListCmd(), log_debug(), log_hexdump(), login(), logMess(), ls(), lwip_fuzztest(), macdef(), main(), makedir(), mdelete(), mget(), mls(), modtime(), MonitorChildThread(), mput(), msvcrt_flush_all_buffers(), NcFTPConfirmResumeDownloadProc(), NcFTPConfirmResumeUploadProc(), newer(), OpenMsg(), OpenPager(), PrintF(), PrintStartupBanner(), PromptForBookmarkName(), proxtrans(), PrPhilBar(), PrStatBar(), ptransfer(), put(), PutCmd(), pwd(), query_done(), quote(), recvrequest(), remglob(), removedir(), rename_file(), renamefile(), restart(), rewrite_client_leases(), SaveCurrentAsBookmark(), SaveUnsavedBookmark(), sendrequest(), SendTelnetInterrupt(), serial_create(), setbell(), setcase(), setcr(), setdebug(), setform(), setglob(), sethash(), setnmap(), setntrans(), setpassive(), setpeer(), setport(), setprompt(), setrunique(), setstruct(), setsunique(), settrace(), settype(), setvbuf(), setverbose(), shell(), site(), sizecmd(), START_TEST(), status(), test_fflush(), test_std_stream_buffering(), test_write_flush_size(), throw(), usage(), user(), wintirpc_debug(), write_client_lease(), write_one_file(), WriteBmLine(), xdrstdio_destroy(), and FileReporter::~FileReporter().

◆ fgetc()

◆ fgetchar()

static int fgetchar ( void  )
inlinestatic

Definition at line 481 of file stdio.h.

481{ return _fgetchar(); }
_ACRTIMP int __cdecl _fgetchar(void)
Definition: file.c:3895

◆ fgetpos()

_ACRTIMP int __cdecl fgetpos ( FILE file,
fpos_t pos 
)

Definition at line 4758 of file file.c.

4759{
4760 *pos = _ftelli64(file);
4761 if(*pos == -1)
4762 return -1;
4763 return 0;
4764}
__int64 CDECL _ftelli64(FILE *file)
Definition: file.c:4672

Referenced by test_filbuf(), test_fileops(), and test_write_flush_size().

◆ fgets()

_ACRTIMP char *__cdecl fgets ( char s,
int  size,
FILE file 
)

Definition at line 3903 of file file.c.

3904{
3905 int cc = EOF;
3906 char * buf_start = s;
3907
3908 TRACE(":file(%p) fd (%d) str (%p) len (%d)\n",
3909 file,file->_file,s,size);
3910
3912
3913 while ((size >1) && (cc = _fgetc_nolock(file)) != EOF && cc != '\n')
3914 {
3915 *s++ = (char)cc;
3916 size --;
3917 }
3918 if ((cc == EOF) && (s == buf_start)) /* If nothing read, return 0*/
3919 {
3920 TRACE(":nothing read\n");
3922 return NULL;
3923 }
3924 if ((cc != EOF) && (size > 1))
3925 *s++ = cc;
3926 *s = '\0';
3927 TRACE(":got %s\n", debugstr_a(buf_start));
3929 return buf_start;
3930}
unsigned char
Definition: typeof.h:29
GLdouble s
Definition: gl.h:2039

Referenced by _tmain(), check_atari(), CheckForNewV3User(), config_load(), create_cache(), create_sic(), CreateCaseDiff(), EndLog(), FGets(), fgetws(), find_str(), gen_add_list(), get_pnames(), GetHostnameFromCommand(), getICMPStats(), File::getline(), getnetconfig(), getnetconfigent(), getnetid(), GetOurHostName(), getpublicandprivatekey(), getrpcent(), getSection(), gl_check_inputrc_for_vi(), gl_histloadfile(), import_base64_certs_from_fp(), init_logger_addr(), InteractiveConsole(), Load_CP2Unicode_Table(), Load_OEM2Unicode_Table(), LocalListCmd(), log_file(), login(), main(), NcFTPConfirmResumeDownloadProc(), NcFTPConfirmResumeUploadProc(), NextLine(), openSection(), ProcessFirewallPrefFile(), ProcessPrefsFile(), read_cache(), read_password(), read_rcfile(), ReadHostsFile(), Readline(), readline(), readSection(), remglob(), rename_file(), SaveCurrentAsBookmark(), SaveUnsavedBookmark(), test__popen(), test__popen_read_child(), test_asciimode(), test_ctrlz(), test_file_put_get(), test_fileops(), test_fprintf(), test_fwprintf(), Test_popen(), test_readmode(), translate_files(), user(), widl_getline(), and xkeymap_read().

◆ fgetwchar()

static wint_t fgetwchar ( void  )
inlinestatic

Definition at line 539 of file stdio.h.

539{ return _fgetwchar(); }
wint_t CDECL _fgetwchar(void)
Definition: file.c:4027

◆ fileno()

static int fileno ( FILE file)
inlinestatic

Definition at line 482 of file stdio.h.

482{ return _fileno(file); }
_ACRTIMP int __cdecl _fileno(FILE *)
Definition: file.c:1925

◆ fopen()

_ACRTIMP FILE *__cdecl fopen ( const char path,
const char mode 
)

Definition at line 4310 of file file.c.

4311{
4312 return _fsopen( path, mode, _SH_DENYNO );
4313}
FILE *CDECL _fsopen(const char *path, const char *mode, int share)
Definition: file.c:4288
#define _SH_DENYNO
Definition: share.h:40

Referenced by CCabinet::AddFile(), tinyxml2::callfopen(), check_atari(), check_bitmap_data(), check_for_files(), CheckForNewV3User(), checkSsiByFilelist(), CCabinet::CommitDisk(), compare_export_(), compat_fopen(), concat_files(), config_load(), copy_file(), CCFDATAStorage::Create(), create_cache(), create_nls_file(), CreateCaseDiff(), DbgHelpAddLineNumber(), disk_openimage(), DoEntry(), DoTestEntry(), EndLog(), ExportBinaryHive(), extract_test(), CCabinet::ExtractFile(), file_exists(), fileClient(), FileExists(), FileReporter::FileReporter(), fopen_file_func(), fopen_s(), gen_add_list(), Generate(), generate_xa_rr_attributes(), get_file_data(), get_ImageBase(), get_list_blocks(), get_subtests(), GetHostnameFromCommand(), getICMPStats(), getnetconfigent(), getnetid(), GetOurHostName(), getpublicandprivatekey(), getrpcent(), getSection(), gl_check_inputrc_for_vi(), gl_histloadfile(), gl_histsavefile(), InfHostOpenFile(), InfHostWriteFile(), init(), init_client(), init_leases_list(), init_logger_addr(), init_proxy(), init_server(), TScript::initScript(), jpeg_open_backing_store(), kbd_c(), kbd_def(), kbd_h(), kbd_rc(), CDFParser::Load(), Load_CP2Unicode_Table(), load_file(), Load_OEM2Unicode_Table(), LoadFile(), LoadFirewallPrefs(), LoadPrefs(), log_file(), logMess(), LogOpen(), LogXfer(), lwip_fuzztest(), main(), MainWndProc(), CCabinet::Open(), File::open(), open_input_file(), open_log_files(), open_merge_image(), OpenBookmarkFile(), openSection(), OpenTmpBookmarkFile(), OpenTrace(), parse_switches(), parseAndPrintFile(), TANSIParser::ParseEscapeANSI(), pfopen(), pp_open_include(), processRequest(), read_cache(), read_file(), read_input_file(), read_JPEG_file(), read_mbr_template(), read_quant_tables(), read_rcfile(), readAllPolygons(), readconfig(), recvrequest(), remglob(), ResourceToFile(), rewrite_client_leases(), RunBookmarkEditor(), ruserpass(), SavePrefs(), SdbpCreate(), select_file_name(), send_file(), sendrequest(), set_LogFile(), CCabinet::SetCabinetReservedFile(), setnetconfig(), setrpcent(), SpoolX(), START_TEST(), TANSIParser::TANSIParser(), FstreamTest::tellp(), test___getmainargs(), test___getmainargs_parent(), test__wfopen_s(), test_asciimode(), test_asciimode2(), test_ctrlz(), Test_DelNodeA(), test_fflush(), test_fgetc(), test_fgetwc(), test_fgetwc_locale(), test_fgetwc_unicode(), test_filbuf(), test_file_put_get(), test_filemodeT(), test_fileops(), test_flsbuf(), test_fopen_exclusive(), test_fopen_fclose_fcloseall(), test_fopen_hints(), test_fopen_s(), test_fprintf(), test_fputc(), test_fputwc(), test_freopen(), test_fscanf(), test_fwprintf(), test_iobuf_layout(), test_readboundary(), test_searchenv(), test_std_stream_open(), test_unlink(), test_utf8(), test_write_flush(), CCFDATAStorage::Truncate(), unpack_iso(), wintirpc_debug(), wpp_parse(), write_casemap_file(), write_client_lease(), write_dlldata(), write_dlldata_list(), write_header(), write_id_data(), write_if_change(), write_JPEG_file(), write_local_stubs(), write_one_file(), write_regscript(), directedLine::writeAllPolygons(), CCabinet::WriteFileToScratchStorage(), CDFParser::WriteInfLine(), xkeymap_open(), xmlMemDisplay(), xmlMemDisplayLast(), xmlMemoryDump(), and xsltDocumentElem().

◆ fopen_s()

_ACRTIMP errno_t __cdecl fopen_s ( FILE **  pFile,
const char filename,
const char mode 
)

Definition at line 4318 of file file.c.

4320{
4321 if (!MSVCRT_CHECK_PMT(pFile != NULL)) return EINVAL;
4322 if (!MSVCRT_CHECK_PMT(filename != NULL)) return EINVAL;
4323 if (!MSVCRT_CHECK_PMT(mode != NULL)) return EINVAL;
4324
4325 *pFile = fopen(filename, mode);
4326
4327 if(!*pFile)
4328 return *_errno();
4329 return 0;
4330}
FILE *CDECL fopen(const char *path, const char *mode)
Definition: file.c:4310
MdFileObject pFile
const char * filename
Definition: ioapi.h:137

Referenced by tinyxml2::callfopen(), CreateSpecFile(), and FileReporter::FileReporter().

◆ fprintf()

◆ fprintf_s()

◆ fputc()

◆ fputchar()

static int fputchar ( int  c)
inlinestatic

Definition at line 483 of file stdio.h.

483{ return _fputchar(c); }
_ACRTIMP int __cdecl _fputchar(int)
Definition: file.c:4398

◆ fputs()

_ACRTIMP int __cdecl fputs ( const char s,
FILE file 
)

Definition at line 4769 of file file.c.

4770{
4771 size_t len = strlen(s);
4772 int ret;
4773
4775 ret = _fwrite_nolock(s, sizeof(*s), len, file) == len ? 0 : EOF;
4777 return ret;
4778}
size_t CDECL _fwrite_nolock(const void *ptr, size_t size, size_t nmemb, FILE *file)
Definition: file.c:4143
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592

Referenced by ios_base::_M_throw_failure(), adns__vdiag(), EndLog(), fdom_split(), GetPass(), LocalListCmd(), main(), poll(), print_dnsfail(), printhelp(), printline(), printusage(), process_file(), REGPROC_open_export_file(), REGPROC_write_line(), test__popen(), test_asciimode(), test_ctrlz(), test_fgetwc(), test_file_put_get(), textDelta(), textDir(), textError(), textOut(), textStatus(), textStep(), textTag(), textWarning(), TIFFPrintDirectory(), ui_create_glyph(), usage(), Usage(), usageerr(), and write_if_change().

◆ fputwchar()

static wint_t fputwchar ( wint_t  wc)
inlinestatic

Definition at line 540 of file stdio.h.

540{ return _fputwchar(wc); }
wint_t CDECL _fputwchar(wint_t wc)
Definition: file.c:4246

◆ fread()

_ACRTIMP size_t __cdecl fread ( void ptr,
size_t  size,
size_t  nmemb,
FILE file 
)

Definition at line 4406 of file file.c.

4407{
4408 size_t ret;
4409
4411 ret = _fread_nolock(ptr, size, nmemb, file);
4413
4414 return ret;
4415}
size_t CDECL _fread_nolock(void *ptr, size_t size, size_t nmemb, FILE *file)
Definition: file.c:4420

◆ fread_s()

_ACRTIMP size_t __cdecl fread_s ( void buffer,
size_t  buffer_size,
size_t  element_size,
size_t  element_count,
FILE stream 
)

Definition at line 30 of file fread.cpp.

37{
38 if (element_size == 0 || element_count == 0)
39 return 0;
40
41 // The rest of the argument validation is done in the _nolock function. Here
42 // we only need to validate that the stream is non-null before we lock it.
43 if (stream == nullptr)
44 {
47
48 _VALIDATE_RETURN(stream != nullptr, EINVAL, 0);
49 }
50
51 size_t return_value = 0;
52
54 __try
55 {
56 return_value = _fread_nolock_s(buffer, buffer_size, element_size, element_count, stream);
57 }
59 {
61 }
63
64 return return_value;
65}
size_t __cdecl _fread_nolock_s(void *const buffer, size_t const buffer_size, size_t const element_size, size_t const element_count, FILE *const public_stream)
Definition: fread.cpp:69
#define __try
Definition: pseh2_64.h:188
#define __endtry
Definition: pseh2_64.h:191
#define __finally
Definition: pseh2_64.h:190

Referenced by fread().

◆ freopen()

_ACRTIMP FILE *__cdecl freopen ( const char path,
const char mode,
FILE file 
)

Definition at line 4624 of file file.c.

4625{
4626 FILE *ret;
4627 wchar_t *pathW = NULL, *modeW = NULL;
4628
4629 if (path && !(pathW = wstrdupa_utf8(path))) return NULL;
4630 if (mode && !(modeW = msvcrt_wstrdupa(mode)))
4631 {
4632 free(pathW);
4633 return NULL;
4634 }
4635
4636 ret = _wfreopen(pathW, modeW, file);
4637
4638 free(pathW);
4639 free(modeW);
4640 return ret;
4641}
FILE *CDECL _wfreopen(const wchar_t *path, const wchar_t *mode, FILE *file)
Definition: file.c:4578

Referenced by freopen_s(), main(), test_freopen(), test_std_stream_buffering(), test_std_stream_open(), and xfwrite().

◆ freopen_s()

_ACRTIMP errno_t __cdecl freopen_s ( FILE **  pFile,
const char path,
const char mode,
FILE file 
)

Definition at line 4646 of file file.c.

4648{
4649 if (!MSVCRT_CHECK_PMT(pFile != NULL)) return EINVAL;
4650 if (!MSVCRT_CHECK_PMT(path != NULL)) return EINVAL;
4651 if (!MSVCRT_CHECK_PMT(mode != NULL)) return EINVAL;
4652 if (!MSVCRT_CHECK_PMT(file != NULL)) return EINVAL;
4653
4654 *pFile = freopen(path, mode, file);
4655
4656 if(!*pFile)
4657 return *_errno();
4658 return 0;
4659}
FILE *CDECL freopen(const char *path, const char *mode, FILE *file)
Definition: file.c:4624

◆ fscanf()

◆ fscanf_s()

◆ fseek()

◆ fsetpos()

_ACRTIMP int __cdecl fsetpos ( FILE file,
fpos_t pos 
)

Definition at line 4664 of file file.c.

4665{
4666 return _fseeki64(file,*pos,SEEK_SET);
4667}

Referenced by test_fileops().

◆ ftell()

◆ fwrite()

_ACRTIMP size_t __cdecl fwrite ( const void ptr,
size_t  size,
size_t  nmemb,
FILE file 
)

Definition at line 4129 of file file.c.

4130{
4131 size_t ret;
4132
4134 ret = _fwrite_nolock(ptr, size, nmemb, file);
4136
4137 return ret;
4138}

◆ getc()

◆ getchar()

_ACRTIMP int __cdecl getchar ( void  )

Definition at line 4813 of file file.c.

4814{
4815 return fgetc(stdin);
4816}

◆ gets()

_ACRTIMP char *__cdecl gets ( char buf)

Definition at line 4871 of file file.c.

4872{
4873 return gets_s(buf, -1);
4874}
char *CDECL gets_s(char *buf, size_t len)
Definition: file.c:4829
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751

◆ getw()

static int getw ( FILE file)
inlinestatic

Definition at line 541 of file stdio.h.

541{ return _getw(file); }
_ACRTIMP int __cdecl _getw(FILE *)
Definition: file.c:3994

◆ pclose()

static int pclose ( FILE file)
inlinestatic

Definition at line 484 of file stdio.h.

484{ return _pclose(file); }
_ACRTIMP int __cdecl _pclose(FILE *)
Definition: process.c:1212

◆ perror()

_ACRTIMP void __cdecl perror ( const char str)

Definition at line 337 of file errno.c.

338{
339 int err = *_errno();
340 if (err < 0 || err > MSVCRT__sys_nerr) err = MSVCRT__sys_nerr;
341
342 if (str && *str)
343 {
344 _write( 2, str, strlen(str) );
345 _write( 2, ": ", 2 );
346 }
348 _write( 2, "\n", 1 );
349}
char * MSVCRT__sys_errlist[]
Definition: errno.c:79
unsigned int MSVCRT__sys_nerr
Definition: errno.c:127
#define err(...)
const WCHAR * str

◆ popen()

static FILE * popen ( const char command,
const char mode 
)
inlinestatic

Definition at line 485 of file stdio.h.

485{ return _popen(command, mode); }
_ACRTIMP FILE *__cdecl _popen(const char *, const char *)
Definition: process.c:1185

◆ printf()

◆ printf_s()

◆ putc()

_ACRTIMP int __cdecl putc ( int  c,
FILE file 
)

◆ putchar()

_ACRTIMP int __cdecl putchar ( int  c)

Definition at line 12 of file crtsupp.c.

13{
14 /* Write to the screen */
16
17 /* For DEBUGGING ONLY */
19 return 0;
20}
VOID NTAPI LlbSerialPutChar(IN CHAR c)
Definition: serial.c:13
VOID NTAPI LlbVideoPutChar(IN UCHAR c)
Definition: video.c:349

Referenced by cmdscanner(), CRT_Tests(), domacro(), getreply(), help(), main(), netfinger(), printBytes(), printusage(), puts(), recvrequest(), sendrequest(), strarray_trace(), and Win32_Tests().

◆ puts()

_ACRTIMP int __cdecl puts ( const char string)

Definition at line 23 of file crtsupp.c.

24{
25 while (*string) putchar(*string++);
26 return 0;
27}
int putchar(int c)
Definition: crtsupp.c:12

Referenced by _tmain(), Align(), AlignAndAlloca(), AlignAndAllocaAndBigLocals(), AlignAndAllocaAndEbpAdj(), AlignAndBigLocals(), AlignAndEbpAdj(), Alloca(), AllocaAndBigLocals(), AllocaAndEbpAdj(), BigLocals(), check_dir(), CRT_Tests(), EbpAdj(), find_str(), foo10(), foo9(), GSCookie(), GSCookieAndAlign(), GSCookieAndAlignAndAlloca(), GSCookieAndAlignAndAllocaAndBigLocals(), GSCookieAndAlignAndAllocaAndEbpAdj(), GSCookieAndAlignAndBigLocals(), GSCookieAndAlignAndEbpAdj(), GSCookieAndAlloca(), GSCookieAndAllocaAndBigLocals(), GSCookieAndAllocaAndEbpAdj(), GSCookieAndBigLocals(), GSCookieAndEbpAdj(), ListTests(), main(), MyErrExit(), printf(), REGPROC_print_error(), RunTests(), Simple(), test(), test10(), test9(), Try(), TryAndAlign(), TryAndAlignAndAlloca(), TryAndAlignAndAllocaAndBigLocals(), TryAndAlignAndAllocaAndEbpAdj(), TryAndAlignAndBigLocals(), TryAndAlignAndEbpAdj(), TryAndAlloca(), TryAndAllocaAndBigLocals(), TryAndAllocaAndEbpAdj(), TryAndBigLocals(), TryAndEbpAdj(), TryAndGSCookie(), TryAndGSCookieAndAlign(), TryAndGSCookieAndAlignAndAlloca(), TryAndGSCookieAndAlignAndAllocaAndBigLocals(), TryAndGSCookieAndAlignAndAllocaAndEbpAdj(), TryAndGSCookieAndAlignAndBigLocals(), TryAndGSCookieAndAlignAndEbpAdj(), TryAndGSCookieAndAlloca(), TryAndGSCookieAndAllocaAndBigLocals(), TryAndGSCookieAndAllocaAndEbpAdj(), TryAndGSCookieAndBigLocals(), TryAndGSCookieAndEbpAdj(), Usage(), and Win32_Tests().

◆ putw()

static int putw ( int  val,
FILE file 
)
inlinestatic

Definition at line 542 of file stdio.h.

542{ return _putw(val, file); }
_ACRTIMP int __cdecl _putw(int, FILE *)
Definition: file.c:3738

◆ remove()

_ACRTIMP int __cdecl remove ( const char path)

Definition at line 4957 of file file.c.

4958{
4959 return _unlink(path);
4960}
int CDECL _unlink(const char *path)
Definition: file.c:1085

◆ rename()

_ACRTIMP int __cdecl rename ( const char oldpath,
const char newpath 
)

Definition at line 4973 of file file.c.

4974{
4975 wchar_t *oldpathW = NULL, *newpathW = NULL;
4976 int ret;
4977
4978 if (oldpath && !(oldpathW = wstrdupa_utf8(oldpath))) return -1;
4979 if (newpath && !(newpathW = wstrdupa_utf8(newpath)))
4980 {
4981 free(oldpathW);
4982 return -1;
4983 }
4984 ret = _wrename(oldpathW, newpathW);
4985 free(oldpathW);
4986 free(newpathW);
4987 return ret;
4988}
int CDECL _wrename(const wchar_t *oldpath, const wchar_t *newpath)
Definition: file.c:4993

Referenced by CloseTrace(), disk_set_information(), EndLog(), handle_nfs41_rename(), LocalRenameCmd(), OpenBookmarkFile(), printercache_rename_blob(), save_licence(), SavePrefs(), SpoolX(), and SwapBookmarkFiles().

◆ rewind()

_ACRTIMP void __cdecl rewind ( FILE file)

Definition at line 1712 of file file.c.

1713{
1714 TRACE(":file (%p) fd (%d)\n",file,file->_file);
1715
1718 clearerr(file);
1720}
void CDECL clearerr(FILE *file)
Definition: file.c:1672
int CDECL _fseek_nolock(FILE *file, __msvcrt_long offset, int whence)
Definition: file.c:1618
#define L(x)
Definition: resources.c:13

Referenced by compare_export_(), FileSize(), main(), rewrite_client_leases(), setrpcent(), test_asciimode(), test_fgetc(), test_filemodeT(), test_fileops(), test_readmode(), and test_write_flush_size().

◆ scanf()

◆ scanf_s()

◆ setbuf()

_ACRTIMP void __cdecl setbuf ( FILE file,
char buf 
)

Definition at line 5046 of file file.c.

5047{
5049}
int CDECL setvbuf(FILE *file, char *buf, int mode, size_t size)
Definition: file.c:5006
#define BUFSIZ
Definition: stdio.h:40
#define _IONBF
Definition: stdio.h:30
#define _IOFBF
Definition: stdio.h:29

Referenced by _fcons(), _Filebuf_base::_M_open(), DllMain(), main(), set_LogFile(), test_fgetc(), and test_flsbuf().

◆ setvbuf()

_ACRTIMP int __cdecl setvbuf ( FILE file,
char buf,
int  mode,
size_t  size 
)

Definition at line 5006 of file file.c.

5007{
5008 if(!MSVCRT_CHECK_PMT(file != NULL)) return -1;
5009 if(!MSVCRT_CHECK_PMT(mode==_IONBF || mode==_IOFBF || mode==_IOLBF)) return -1;
5010 if(!MSVCRT_CHECK_PMT(mode==_IONBF || (size>=2 && size<=INT_MAX))) return -1;
5011
5013
5015 if(file->_flag & _IOMYBUF)
5016 free(file->_base);
5017 file->_flag &= ~(MSVCRT__NOBUF | _IOMYBUF | MSVCRT__USERBUF);
5018 file->_cnt = 0;
5019
5020 if(mode == _IONBF) {
5021 file->_flag |= MSVCRT__NOBUF;
5022 file->_base = file->_ptr = (char*)&file->_charbuf;
5023 file->_bufsiz = 2;
5024 }else if(buf) {
5025 file->_base = file->_ptr = buf;
5026 file->_flag |= MSVCRT__USERBUF;
5027 file->_bufsiz = size;
5028 }else {
5029 file->_base = file->_ptr = malloc(size);
5030 if(!file->_base) {
5031 file->_bufsiz = 0;
5033 return -1;
5034 }
5035
5036 file->_flag |= _IOMYBUF;
5037 file->_bufsiz = size;
5038 }
5040 return 0;
5041}
#define malloc
Definition: debug_ros.c:4
#define _IOLBF
Definition: stdio.h:31

Referenced by _tWinMain(), fileClient(), main(), OpenTrace(), pipeClient(), processRequest(), setbuf(), test_fileops(), test_flsbuf(), test_iobuf_layout(), test_std_stream_buffering(), test_write_flush(), and throw().

◆ snprintf()

static int __cdecl static int __cdecl snprintf ( char buffer,
size_t  size,
const char format,
  ... 
)
inlinestatic

Definition at line 495 of file stdio.h.

496{
497 int ret;
499
502 va_end(args);
503 return ret;
504}
#define vsnprintf
Definition: tif_win32.c:406

◆ sprintf()

static int __cdecl static int __cdecl sprintf ( char buffer,
const char format,
  ... 
)
inlinestatic

Definition at line 519 of file stdio.h.

520{
521 int ret;
523
526 va_end(args);
527 return ret;
528}
#define _CRT_INT_MAX
Definition: corecrt.h:158

◆ sprintf_s()

◆ sscanf()

Referenced by __rpc_get_time_offset(), _ecvt(), _ecvt_s(), Addhost(), ata_bblk(), cache_entry_create(), check_version(), CheckForNewV3User(), create_sic(), CRYPT_AsnEncodeOid(), Deletehost(), DissectArcPath2(), doChild(), DoCOMPANY(), DoCOPYRIGHT(), DoDESCRIPTIONS(), DoKBD(), DoKEYNAME(), DoLANGUAGENAMES(), DoLAYOUT(), DoLOCALENAME(), DoSHIFTSTATE(), DoVERSION(), error(), find_typelib_key(), FTP_DoPassive(), FTP_ParseNextFile(), FTPFileSize(), getCharacterInfo(), getit(), GetOptUlong(), GetStartSpoolDate(), getVKNum(), handle_address_cmd(), handle_escape_cmd(), initconn(), is_float(), is_guid(), is_integer(), isOffset(), jinit_memory_mgr(), load_persistent_cookie(), main(), match_mod(), modtime(), my_atoi(), netname2user(), ntlm_AcceptSecurityContext(), ntlm_InitializeSecurityContextW(), OpenBookmarkFile(), optionParse(), parse_arguments(), parse_list_response(), parse_stat_response(), parse_switches(), parse_uidl_response(), ParseHostLine(), Passive(), set_quality_ratings(), set_quant_slots(), set_sample_factors(), SkipLines(), SLTG_DoRefs(), START_TEST(), test_enumdisplaydevices(), test_enumdisplaydevices_adapter(), test_enumdisplaydevices_monitor(), test_file_inherit_child(), Test_ifuncs(), test_listbox_dlgdir(), test_listbox_LB_DIR(), test_retval(), test_strdate(), test_strtime(), TestCrossProcessDecrypt(), TLB_GUIDFromString(), translate_line(), uaddr_to_sockaddr(), UnDate(), UnDosLine(), UnLslRLine(), UnMDTMDate(), UnMlsT(), URLCopyToken(), RequestHandler::urldec(), UXTHEME_RestoreSystemMetrics(), wined3d_adapter_init_gl_caps(), xmlInitMemory(), and xsltNumberComp().

◆ sscanf_s()

◆ tempnam()

static char * tempnam ( const char dir,
const char prefix 
)
inlinestatic

Definition at line 486 of file stdio.h.

486{ return _tempnam(dir, prefix); }
_ACRTIMP char *__cdecl _tempnam(const char *, const char *)
Definition: file.c:3441

Referenced by get_subtests(), and run_tests().

◆ tmpfile()

_ACRTIMP FILE *__cdecl tmpfile ( void  )

Definition at line 5199 of file file.c.

5200{
5201 char *filename = _tempnam(",", "t");
5202 int fd;
5203 FILE* file = NULL;
5204
5205 LOCK_FILES();
5208 if (fd != -1 && (file = msvcrt_alloc_fp()))
5209 {
5210 if (msvcrt_init_fp(file, fd, _IORW) == -1)
5211 {
5212 file->_flag = 0;
5213 file = NULL;
5214 }
5215 else file->_tmpfname = _strdup(filename);
5216 }
5217
5218 if(fd != -1 && !file)
5219 _close(fd);
5220 free(filename);
5221 UNLOCK_FILES();
5222 return file;
5223}
#define _S_IWRITE
Definition: stat.h:85
#define _S_IREAD
Definition: stat.h:84
#define _strdup
Definition: debug_ros.c:7
#define _O_RDWR
Definition: cabinet.h:39
#define _O_BINARY
Definition: cabinet.h:51
#define _O_TEMPORARY
Definition: cabinet.h:44
#define _O_CREAT
Definition: cabinet.h:46
static FILE * msvcrt_alloc_fp(void)
Definition: file.c:615
char *CDECL _tempnam(const char *dir, const char *prefix)
Definition: file.c:3441
int WINAPIV _open(const char *path, int flags,...)
Definition: file.c:2655
static int msvcrt_init_fp(FILE *file, int fd, unsigned stream_flags)
Definition: file.c:649

◆ tmpnam()

_ACRTIMP char *__cdecl tmpnam ( char s)

Definition at line 5108 of file file.c.

5109{
5110 if (!s) {
5112
5113 if(!data->tmpnam_buffer)
5114 data->tmpnam_buffer = malloc(MAX_PATH);
5115
5116 s = data->tmpnam_buffer;
5117 }
5118
5119 return tmpnam_helper(s, -1, &tmpnam_unique, TMP_MAX) ? NULL : s;
5120}
#define MAX_PATH
Definition: compat.h:34
static LONG tmpnam_unique
Definition: file.c:285
static int tmpnam_helper(char *s, size_t size, LONG *tmpnam_unique, int tmp_max)
Definition: file.c:5051
#define TMP_MAX
Definition: stdio.h:35
thread_data_t *CDECL msvcrt_get_thread_data(void)
Definition: thread.c:45

Referenced by CCFDATAStorage::Create(), test_tmpnam(), and tmpfile().

◆ ungetc()

_ACRTIMP int __cdecl ungetc ( int  c,
FILE file 
)

Definition at line 5732 of file file.c.

5733{
5734 int ret;
5735
5736 if(!MSVCRT_CHECK_PMT(file != NULL)) return EOF;
5737
5741
5742 return ret;
5743}
int CDECL _ungetc_nolock(int c, FILE *file)
Definition: file.c:5748

Referenced by _fgetwc_nolock(), select_file_type(), test_fileops(), and ungetwc().

◆ unlink()

static int unlink ( const char path)
inlinestatic

Definition at line 488 of file stdio.h.

488{ return _unlink(path); }
_ACRTIMP int __cdecl _unlink(const char *)
Definition: file.c:1085

◆ vfprintf()

◆ vfprintf_s()

◆ vprintf()

◆ vprintf_s()

◆ vsnprintf()

◆ vsprintf()

◆ vsprintf_s()

◆ wpopen()

static FILE * wpopen ( const wchar_t command,
const wchar_t mode 
)
inlinestatic

Definition at line 543 of file stdio.h.

543{ return _wpopen(command, mode); }
_ACRTIMP FILE *__cdecl _wpopen(const wchar_t *, const wchar_t *)
Definition: process.c:1044