MCPcopy Create free account
hub / github.com/Inori/GPCS4 / LoadFile

Function LoadFile

GPCS4/Platform/PlatFile.cpp:7–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5{;
6
7bool LoadFile(const std::string& strFilename, std::vector<uint8_t>& vtData)
8{
9 bool bRet = false;
10 do
11 {
12 if (strFilename.empty())
13 {
14 break;
15 }
16
17 std::ifstream fin(strFilename, std::ifstream::in | std::ifstream::ate | std::ifstream::binary);
18 if (!fin.is_open())
19 {
20 break;
21 }
22
23 size_t nFileSize = (size_t)fin.tellg();
24 vtData.resize(nFileSize);
25
26 fin.seekg(0);
27 fin.read((char*)vtData.data(), nFileSize);
28
29 fin.close();
30
31 bRet = true;
32 } while (false);
33 return bRet;
34}
35
36std::vector<uint8_t> LoadFile(const std::string& strFilename)
37{

Callers 1

loadFileMethod · 0.85

Calls 5

emptyMethod · 0.45
resizeMethod · 0.45
readMethod · 0.45
dataMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected