Normally, the Linein function returns a line from an input stream, at the current read position. Alternatively, the Linein function establishes a subsequent read position, and returns an empty string.
If a complete line is not available, the result will contain only the characters which remain .. AND the NOTREADY condition is raised.
When the default input stream is associated with keyboard input, the program will wait until the user types a complete line at the keyboard. The user may have difficulty identifying the program is waiting for input.
result = Linein( [ stream ] [, [ line# ] [, count ] ] ) |
When the line# argument is absent, text is read from the current read position associated with the stream. The read position is the offset where a prior Charin or Linein request completed. Initially the read position is the beginning of the input stream.
A Linein request will return a partial line, if a prior Charin request read character(s) at the start of the line.
When the length argument is omitted, and the start arguments is present the current read position of the stream is set to the start position, and the empty string is returned.
Examples:
say Linein() -- shows one line that is obtained from the default input stream. say Linein( '' ) -- shows one line that is obtained from the default input stream. say Linein( 'file1' ) -- shows one line that is obtained from the stream named 'file1' say Linein( 'file1', 5 ) -- shows the fifth line from the stream named 'file1' say Linein( 'file1', 5, 0 ) -- adjusts the position to the fifth line of the stream named 'file1' |