ReactOS 0.4.15-dev-8207-gd73a838
fstream_win32io.cpp File Reference
#include <fstream>
#include <io.h>
#include <fcntl.h>
#include <sys/stat.h>
Include dependency graph for fstream_win32io.cpp:

Go to the source code of this file.

Macros

#define _TEXTBUF_SIZE   0x1000
 
#define INVALID_SET_FILE_POINTER   0xffffffff
 
#define O_ACCMODE   (O_RDONLY|O_WRONLY|O_RDWR)
 
#define _STLP_LF   10
 
#define _STLP_CR   13
 
#define _STLP_CTRLZ   26
 

Functions

static _STLP_BEGIN_NAMESPACE ios_base::openmode flag_to_openmode (int mode)
 
static _STLP_MOVE_TO_PRIV_NAMESPACE bool __is_regular_file (_STLP_fd fd)
 
static streamoff __file_size (_STLP_fd fd)
 

Variables

const _STLP_fd INVALID_STLP_FD = INVALID_HANDLE_VALUE
 

Macro Definition Documentation

◆ _STLP_CR

#define _STLP_CR   13

Definition at line 384 of file fstream_win32io.cpp.

◆ _STLP_CTRLZ

#define _STLP_CTRLZ   26

Definition at line 385 of file fstream_win32io.cpp.

◆ _STLP_LF

#define _STLP_LF   10

Definition at line 383 of file fstream_win32io.cpp.

◆ _TEXTBUF_SIZE

#define _TEXTBUF_SIZE   0x1000

Definition at line 31 of file fstream_win32io.cpp.

◆ INVALID_SET_FILE_POINTER

#define INVALID_SET_FILE_POINTER   0xffffffff

Definition at line 36 of file fstream_win32io.cpp.

◆ O_ACCMODE

#define O_ACCMODE   (O_RDONLY|O_WRONLY|O_RDWR)

Definition at line 40 of file fstream_win32io.cpp.

Function Documentation

◆ __file_size()

static streamoff __file_size ( _STLP_fd  fd)
static

Definition at line 81 of file fstream_win32io.cpp.

81 {
82 streamoff ret = 0;
83
85 li.LowPart = GetFileSize(fd, (unsigned long*) &li.HighPart);
87 ret = li.QuadPart;
88
89 return ret;
90}
off_t streamoff
Definition: char_traits.h:74
#define NO_ERROR
Definition: dderror.h:5
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235
static int fd
Definition: io.c:51
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG LowPart
Definition: typedefs.h:106
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define INVALID_FILE_SIZE
Definition: winbase.h:548

◆ __is_regular_file()

static _STLP_MOVE_TO_PRIV_NAMESPACE bool __is_regular_file ( _STLP_fd  fd)
static

Definition at line 72 of file fstream_win32io.cpp.

72 {
74
75 // Return true if the file handle isn't a directory.
77 ((info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0);
78}
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
Definition: fileinfo.c:458
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705

◆ flag_to_openmode()

static _STLP_BEGIN_NAMESPACE ios_base::openmode flag_to_openmode ( int  mode)
static

Definition at line 46 of file fstream_win32io.cpp.

46 {
47 ios_base::openmode ret = ios_base::__default_mode;
48
49 switch (mode & O_ACCMODE) {
50 case O_RDONLY:
51 ret = ios_base::in; break;
52 case O_WRONLY:
53 ret = ios_base::out; break;
54 case O_RDWR:
55 ret = ios_base::in | ios_base::out; break;
56 }
57
58 if (mode & O_APPEND)
59 ret |= ios_base::app;
60
61 if (mode & O_BINARY)
62 ret |= ios_base::binary;
63
64 return ret;
65}
#define O_WRONLY
Definition: acwin.h:111
#define O_BINARY
Definition: acwin.h:109
#define O_RDONLY
Definition: acwin.h:108
int openmode
Definition: _ios_base.h:59
#define O_ACCMODE
GLenum mode
Definition: glext.h:6217
#define O_RDWR
Definition: fcntl.h:36
#define O_APPEND
Definition: fcntl.h:37

Variable Documentation

◆ INVALID_STLP_FD

const _STLP_fd INVALID_STLP_FD = INVALID_HANDLE_VALUE

Definition at line 33 of file fstream_win32io.cpp.