Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print Value to File

Tags:

ocaml

i was not able to print an a value (float) to a file with the OCaml lenguage. How can i do? If you know how, can you show me a little example?

Thank you advance and have a good day!

like image 639
Zany Avatar asked Dec 29 '22 01:12

Zany


1 Answers

Printf.fprintf allows direction to an out_channel, in your case a file. Reasonably, you'd open the file for writing first, and pass around that channel.

Printf.fprintf (open_out "file.txt") "Float Value of %f" 1.0
like image 182
nlucaroni Avatar answered Jan 30 '23 09:01

nlucaroni