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

Function ReadFileAsString

SHTest/SampleFramework12/v1.04/FileIO.cpp:144–154  ·  view source on GitHub ↗

Returns the contents of a file as a string

Source from the content-addressed store, hash-verified

142
143// Returns the contents of a file as a string
144std::string ReadFileAsString(const wchar* filePath)
145{
146 File file(filePath, FileOpenMode::Read);
147 uint64 fileSize = file.Size();
148
149 std::string fileContents;
150 fileContents.resize(size_t(fileSize), 0);
151 file.Read(fileSize, &fileContents[0]);
152
153 return fileContents;
154}
155
156// Writes the contents of a string to a file
157void WriteStringAsFile(const wchar* filePath, const std::string& data)

Callers 1

GetExpandedShaderCodeFunction · 0.85

Calls 3

SizeMethod · 0.45
resizeMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected