Open generic function
Reads a stream up to the next newline into a string.
read-line-into! input-stream string
#key start on-end-of-stream grow?
=> string-or-eof newline?
<stream>.
<string>.
<integer>. Default value: 0.
<object>.
<boolean>. Default value: #f.
<string>, or an instance of <object> if the end of the stream is reached.
<boolean>.
io
streams
Fills string with all the input from input-stream up to the next newline sequence. The string must be a general instance of <string> that can hold elements of the stream's element type.
The input is written into string starting at the position start. By default, start is the start of the stream.
The second return value is #t if the read terminated with a newline, or #f if the read completed by getting to the end of the input stream.
If grow? is #t, and string is not large enough to hold all of the input, read-line-into! creates a new string which it writes to and returns instead. The resulting string holds all the original elements of string, except where read-line-into! overwrites them with input from input-stream.
In a manner consistent with the intended semantics of grow?, when grow? is #t and start is greater than or equal to string.size, read-line-into! grows string to accommodate the start index and the new input.
If grow? is #f and string is not large enough to hold the input, the function signals an error.
The end-of-stream behavior and the interpretation of on-end-of-stream is the same as that of read-line.