MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / readFileString

Method readFileString

source/core/StarFile.cpp:67–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67String File::readFileString(String const& filename) {
68 FilePtr file = File::open(filename, IOMode::Read);
69 std::string str;
70 while (!file->atEnd()) {
71 char buffer[1024];
72 size_t r = file->read(buffer, 1024);
73 for (size_t i = 0; i < r; ++i)
74 str.push_back(buffer[i]);
75 }
76
77 return str;
78}
79
80StreamOffset File::fileSize(String const& filename) {
81 return File::open(filename, IOMode::Read)->size();

Callers

nothing calls this directly

Calls 3

atEndMethod · 0.45
readMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected