10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-09 07:33:53 +01:00
quantum_package/ocaml/Io_ext.ml

25 lines
373 B
OCaml
Raw Normal View History

2017-08-18 18:28:33 +02:00
let input_lines filename =
let in_channel =
open_in filename
in
let rec aux accu =
try
let newline =
input_line in_channel
in
aux (newline::accu)
with End_of_file -> accu
in
let result =
List.rev (aux [])
in
close_in in_channel;
result
let read_all filename =
input_lines filename
|> String.concat "\n"