diff options
Diffstat (limited to '2025/ocaml/lib/infrastructure')
| -rw-r--r-- | 2025/ocaml/lib/infrastructure/file_reader.ml | 4 | ||||
| -rw-r--r-- | 2025/ocaml/lib/infrastructure/file_reader.mli | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/2025/ocaml/lib/infrastructure/file_reader.ml b/2025/ocaml/lib/infrastructure/file_reader.ml new file mode 100644 index 0000000..7a80c0b --- /dev/null +++ b/2025/ocaml/lib/infrastructure/file_reader.ml @@ -0,0 +1,4 @@ +let read_file filename = + let chan = In_channel.open_text filename in + let content = In_channel.input_all chan in + In_channel.close chan ; content diff --git a/2025/ocaml/lib/infrastructure/file_reader.mli b/2025/ocaml/lib/infrastructure/file_reader.mli new file mode 100644 index 0000000..bb40577 --- /dev/null +++ b/2025/ocaml/lib/infrastructure/file_reader.mli @@ -0,0 +1,3 @@ +val read_file : string -> string +(** [read_file filename] is the contents of [filename] as a string. + The empty string is returned if [filename] does not exist. *) |
