Skip to content

Rose::StringUtility::readFile

Reads entire text file.

Synopsis

Declared in <src/Rose/StringUtility/FileUtility.h>

[[visibility]]
std::string
readFile(std::string const& fileName);

Description

Opens the specified file, reads its contents into a string, closes the file, and returns that string.

If the file cannot be opened then an std::string error message is thrown. The message reads "File not found" regardless of the actual error condition.

Return Value

File contents.

Parameters

Name

Description

fileName

File to read.

Created with MrDocs