summaryrefslogtreecommitdiff
path: root/ocaml/lib/shared/file.ml
diff options
context:
space:
mode:
Diffstat (limited to 'ocaml/lib/shared/file.ml')
-rw-r--r--ocaml/lib/shared/file.ml6
1 files changed, 6 insertions, 0 deletions
diff --git a/ocaml/lib/shared/file.ml b/ocaml/lib/shared/file.ml
new file mode 100644
index 0000000..74b5abc
--- /dev/null
+++ b/ocaml/lib/shared/file.ml
@@ -0,0 +1,6 @@
+(** [read filename] is the contents of [filename] as a string.
+ The empty string is returned if [filename] does not exist. *)
+let read filename =
+ let chan = In_channel.open_text filename in
+ let content = In_channel.input_all chan in
+ In_channel.close chan ; content