company logo

TextFile :: readLine - Get next line from file

The function returns the next line from a text file. The function is supported for line processing and throws an exception when file processing mode is different from LineProcessing. When lineprocessing is still undefined, it will be set to LineProcessing

When a line has been read successfully, the function returns true. At end of file, the function returns an end of file string (String::isEOF()).

In case of errors, the function throws an exception.

int readfile ( STRING filepath ) { // osi function

variables

  TextFile     tf(filepath)

  string       lin;

  int         cnt;

process

  while ( !lin.isEOF ) {

    lin = tf.readLine;

    ++cnt;

  }

  Message(cnt-1);

}

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

Implementation details

odaba::String TextFile  :: readLine (  )

The next line is returned as string without terminating line characters (\n, \r).