Antonis
Antonis

Reputation: 35

Read char from file in SML

I need to read characters from a file in SML. I have this piece of code for reading integers:

fun readInt input = Option.valOf (TextIO.scanStream (Int.scan StringCvt.DEC) input)

Is there something equivalent for characters? I've seen that there is Char.scan but I am not very sure on how to use it. Thanx in advance !!

Upvotes: 2

Views: 838

Answers (1)

newacct
newacct

Reputation: 122538

How about something like Option.valOf (TextIO.input1 input)

Upvotes: 2

Related Questions