MCPcopy Create free account
hub / github.com/Tracktion/choc / loadFileAsString

Function loadFileAsString

choc/text/choc_Files.h:172–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172inline std::string loadFileAsString (const std::filesystem::path& filename)
173{
174 std::string result;
175
176 readFileContent (filename, [&] (uint64_t size)
177 {
178 result.resize (static_cast<std::string::size_type> (size));
179 return result.data();
180 });
181
182 return result;
183}
184
185template <typename WriteFn>
186void createAndWriteToFile (const std::filesystem::path& path, WriteFn&& write)

Callers 2

testFileUtilitiesFunction · 0.85
choc_tests.hFile · 0.85

Calls 3

readFileContentFunction · 0.85
resizeMethod · 0.45
dataMethod · 0.45

Tested by 1

testFileUtilitiesFunction · 0.68