You error is in TextIO.StreamIO.input1
, you most likely mean TextIO.input1
.
If you really need/wan't to work with the file using StreamIO, you have to convert the instream
type returned by openIN
, to an StreamIO.instream
with the TextIO.getInstream
function.
You can read more about all this in the SML Basis library TEXT_IO signature.
Remember that it is good practice to close the files when you are done reading from them.
Update
As suggested in the comments, you can either read in the entire file (if you know it is small) or you can read it line by line.
The easiest thing to do, if you wan't to get the contents word by word, is to split the content by whitespace. This way you will end up with a list of strings that represent each individual "words" from the file.