lang • lineinput

LINE INPUT

LINE INPUT [ # Stream , ] Variable

Reads an entire line of text from the text stream Stream into a String Variable.

If the stream Stream is not specified, then the standard input is used.

The entire line is read, except the end-of-line delimiter.

The end-of-line delimiter can be defined with the Stream.EndOfLine property. It is gb.Unix by default, which selects a single Chr$(10) character.

Do not use this instruction to read from binary files, because you will lose the linefeed characters. Use READ instead.

Do not use this instruction inside the Read event of a process that does not necessarily send a newline (because it is printing a prompt for example). It will block forever waiting for the newline character.

Examples

Dim hFile As Stream
Dim sOneLine As String

' Print a file to standard output
hFile = Open "/etc/hosts" For Input

While Not Eof(hFile)
  Line Input #hFile, sOneLine
  Print sOneLine
Wend

Close #hFile

See also