company logo

String :: loadFile - Read file into string

The function reads a text file passed in sFilePath into the string. When the string already contains data, this will be overwritten. The function throws an exception, when the file path does not refer to a valid file.

// load text data from file to database

... fragment ( Property my_notes ) {

  my_notes.assign(String().loadFile("notes.txt"));

}

Notes:

The function does not check, whether the file contains valid data, i.e. reading binary files may cause problems when accessing data.

Return value:  Text string ( odaba::String & )

The text string contains text with any kind of character encoding.

Implementation details

odaba::String & String  :: loadFile ( odaba::String &sFilePath )
  • sFilePath - Complete file path