views:

152

answers:

2

how do i prompt for user input in a running function?

+2  A: 

to read a line from standard input, I think you can just do something like

TextIO.inputLine TextIO.stdIn
newacct
+2  A: 

My code looks something like this:

fun get infile = ( TextIO.output(TextIO.stdOut, prompt)
                 ; TextIO.flushOut(TextIO.stdOut)
                 ; TextIO.inputLine infile
                 )

This returns a value of type string option; normally a line SOME l, but NONE on end of file.

Norman Ramsey