MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / LoadFileToBuffer

Function LoadFileToBuffer

test/tests/S6ImportExportTests.cpp:37–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35using namespace OpenRCT2;
36
37static bool LoadFileToBuffer(MemoryStream& stream, const std::string& filePath)
38{
39 FILE* fp = fopen(filePath.c_str(), "rb");
40 EXPECT_NE(fp, nullptr);
41 if (fp == nullptr)
42 return false;
43
44 uint8_t buf[1024];
45 size_t bytesRead = fread(buf, 1, sizeof(buf), fp);
46 while (bytesRead > 0)
47 {
48 stream.Write(buf, bytesRead);
49 bytesRead = fread(buf, 1, sizeof(buf), fp);
50 }
51 fclose(fp);
52
53 return true;
54}
55
56static void GameInit(bool retainSpatialIndices)
57{

Callers 1

TESTFunction · 0.85

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected