MCPcopy Create free account
hub / github.com/TheRealMJP/Shadows / ReadFileAsString

Function ReadFileAsString

Shadows/SampleFramework11/FileIO.cpp:111–121  ·  view source on GitHub ↗

Returns the contents of a file as a string

Source from the content-addressed store, hash-verified

109
110// Returns the contents of a file as a string
111std::string ReadFileAsString(const wchar* filePath)
112{
113 File file(filePath, File::OpenRead);
114 uint64 fileSize = file.Size();
115
116 std::string fileContents;
117 fileContents.resize(size_t(fileSize), 0);
118 file.Read(fileSize, &fileContents[0]);
119
120 return fileContents;
121}
122
123// Writes the contents of a string to a file
124void WriteStringAsFile(const wchar* filePath, const std::string& data)

Callers 1

GetExpandedShaderCodeFunction · 0.85

Calls 2

ReadMethod · 0.60
SizeMethod · 0.45

Tested by

no test coverage detected