A very basic example below.
Recommend you search discourse for more complete examples.
str = Printf.format(s, Inf, Inf, NaN, NaN)
io = open("fileout.txt", "a");
write(io, str);
close(io);
or better:
io = open("fileout.txt", "a");
Printf.format(io, s, Inf, Inf, NaN, NaN)
close(io);