Rose::StringUtility::readFileWithPos¶
Reads an entire text file.
Synopsis¶
Declared in <src/Rose/StringUtility/FileUtility.h>
[[visibility("default")]]
FileWithLineNumbers
readFileWithPos(std::string const& fileName); Description¶
Opens the specified file, reads its contents line by line into a vector of strings with location information, closes the file, and returns the vector. The file names in the returned value are absolute names. The strings in the return value have their final line-feeds removed.
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 with line numbers.
Parameters¶
| Name | Description |
|---|---|
| fileName | File to read. |
Created with MrDocs