MCPcopy Create free account
hub / github.com/JayXon/Leanify / File

Method File

fileio.cpp:117–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115} // namespace
116
117File::File(const wchar_t *filepath)
118{
119 fp_ = nullptr;
120 hFile_ = CreateFile(filepath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_WRITE_THROUGH, nullptr);
121 if (hFile_ == INVALID_HANDLE_VALUE)
122 {
123 PrintErrorMessage("Open file error!");
124 size_ = 0;
125 return;
126 }
127 size_ = GetFileSize(hFile_, nullptr);
128 hMap_ = CreateFileMapping(hFile_, nullptr, PAGE_READWRITE, 0, 0, nullptr);
129 if (hMap_ == INVALID_HANDLE_VALUE)
130 {
131 PrintErrorMessage("Map file error!");
132 return;
133 }
134 fp_ = MapViewOfFile(hMap_, FILE_MAP_ALL_ACCESS, 0, 0, 0);
135}
136
137void File::UnMapFile(size_t new_size)
138{

Callers

nothing calls this directly

Calls 1

PrintErrorMessageFunction · 0.85

Tested by

no test coverage detected