omni::extras::readFile

Defined in omni/extras/FileSystemHelpers.h

inline std::pair<bool, std::string> omni::extras::readFile(const char *path)

Reads file content into a string.

Warning

This function reads data in a binary fashion and stores it in a std::string. As such, the string may contain non-printable characters or even NUL characters. No conversion of Windows line endings is performed.

Parameters

path – The path to read

Returns

a std::pair, where the first member indicates success if true and the second member is the contents; if first is false then second will always be empty. If the file is valid but empty, first will be true but second will be empty.