700resu
700resu

Reputation: 259

writing integers to a file in sml

Is there a output in textIO signature to write integers to a file? output only writes vectors, outputsstring writes substrings and output1 writes only characters. My problem with not using vectors is I have to write each integer into a line in the output file.

I am having tough time with SML.

Thank You.

Upvotes: 0

Views: 461

Answers (1)

sepp2k
sepp2k

Reputation: 370202

To write an int to a file as a string, just convert it to a string using Int.toString and then write the string to the file.

To write a number to a file as a byte, use BinIO instead of TextIO. As the name suggests TextIO is for dealing with text - not binary data.

Upvotes: 1

Related Questions