Next Previous Up Top Contents Index

5.11 The STREAMS module

read-line

Open generic function

Summary

Reads a stream up to the next newline.

Signature

read-line input-stream #key on-end-of-stream 
=> string-or-eof newline?

Arguments

input-stream
An instance of <stream>.

on-end-of-stream
An instance of <object>.

Values

string-or-eof
An instance of <string>, or an instance of <object> if the end of the stream is reached.

newline?
An instance of <boolean>.

Library

io

Module

streams

Description

Returns a new string containing all the input in input-stream up to the next newline sequence.

The resulting string does not contain the newline sequence. The second value returned is #t if the read terminated with a newline or #f if the read terminated because it came to the end of the stream.

The type of the result string is chosen so that the string can contain characters of input-stream's element type. For example, if the element type is <byte-character>, the string will be a <byte-string>.

If input-stream is at its end immediately upon calling read-line (that is, the end of stream appears to be at the end of an empty line), then the end-of-stream behavior and the interpretation of on-end-of-stream is as for read-element.

Example

See also

read-element, page 44


System and I/O Reference - 31 MAR 2000

Next Previous Up Top Contents Index