TEXT_STREAM_IO extends the
STREAM_IO signature to accommodate text I/O. In particular, it binds the I/O element to
Char.char, and provides several text-based I/O operations.
where type vector = CharVector.vector
where type elem = Char.char
val inputLine : instream -> (string * instream) option
val outputSubstr : outstream * substring -> unit
, where ln is the next line of input in the stream strm and strm' is the residual stream. Specifically, ln returns all characters from the current position up to and including the next newline (
#"\n") character. If it detects an end-of-stream before the next newline, it returns the characters read appended with a newline. Thus, ln is guaranteed to always be new-line terminated (and thus nonempty). If the current stream position is the end-of-stream, then it returns
NONE. It raises
Sizeif the length of the line exceeds the length of the longest string.
outputSubstr (strm, ss)
output (strm, Substring.string ss)
Generated April 12, 2004
Last Modified July 1, 2002
Comments to John Reppy.
This document may be distributed freely over the internet as long as the copyright notice and license terms below are prominently displayed within every machine-readable copy.
Copyright © 2004 AT&T and Lucent Technologies. All rights reserved.
Permission is granted for internet users to make one paper copy for their
own personal use. Further hardcopy reproduction is strictly prohibited.
Permission to distribute the HTML document electronically on any medium
other than the internet must be requested from the copyright holders by
contacting the editors.
Printed versions of the SML Basis Manual are available from Cambridge
To order, please visit
www.cup.org (North America) or
www.cup.cam.ac.uk (outside North America).