streamreader_object.ReadLine Method

Reads a line from the input stream terminated by LF, CR, or CR-LF.

...steamreader_object.ReadLine()

Prerequisites

The input stream must have been opened using a New to create the streamreader_object.

Parameters

None

Remarks

This method returns a String containing the next bytes in the input stream up to the next LF character (decimal value 10, GPL_LF) or CR character (decimal 13, GPL_CR). It blocks until the data followed by these line terminators is received or the end-of-file is seen. Any LF, CR, or CR-LF pair is removed from the end of the string. Note that the StreamWriterNewLine property does not have any effect on how ReadLine interprets the end of line. Be careful when using this method to read data from a serial port since it blocks until a line terminator is seen. If for some reason the line terminator is lost or corrupted due to an error, this method will continue blocking and hang your procedure.

If some other I/O error occurs, this method throws an Exception.

Examples

Dim file As New StreamReader("/flash/data.txt")
Dim line As String
line = file.ReadLine()

See Also

File and Serial I/O | streamreader_object.Read