summaryrefslogtreecommitdiff
path: root/stdlib/out_channel.mli
diff options
context:
space:
mode:
authorNicolás Ojeda Bär <n.oje.bar@gmail.com>2021-09-29 22:30:31 +0200
committerGitHub <noreply@github.com>2021-09-29 22:30:31 +0200
commit07dfba8594dd134438d1a01ffb68be3e6519ac45 (patch)
tree3c6a9340fb1acfaf989352129112d481b0096ca6 /stdlib/out_channel.mli
parent64023f55c659c8574d6a53ec3daf43b1ccd97972 (diff)
downloadocaml-07dfba8594dd134438d1a01ffb68be3e6519ac45.tar.gz
Add {In,Out}_channel.with_open_{bin,text,gen} and In_channel.input_all (#10596)
Diffstat (limited to 'stdlib/out_channel.mli')
-rw-r--r--stdlib/out_channel.mli13
1 files changed, 13 insertions, 0 deletions
diff --git a/stdlib/out_channel.mli b/stdlib/out_channel.mli
index 8a70b50cda..e371bd9d74 100644
--- a/stdlib/out_channel.mli
+++ b/stdlib/out_channel.mli
@@ -56,6 +56,19 @@ val open_gen : open_flag list -> int -> string -> t
created. {!open_text} and {!open_bin} are special cases of this
function. *)
+val with_open_bin : string -> (t -> 'a) -> 'a
+(** [with_open_bin fn f] opens a channel [oc] on file [fn] and returns [f
+ oc]. After [f] returns, either with a value or by raising an exception, [oc]
+ is guaranteed to be closed. *)
+
+val with_open_text : string -> (t -> 'a) -> 'a
+(** Like {!with_open_bin}, but the channel is opened in text mode (see
+ {!open_text}). *)
+
+val with_open_gen : open_flag list -> int -> string -> (t -> 'a) -> 'a
+(** Like {!with_open_bin}, but can specify the opening mode and file permission,
+ in case the file must be created (see {!open_gen}). *)
+
val seek : t -> int64 -> unit
(** [seek chan pos] sets the current writing position to [pos] for channel
[chan]. This works only for regular files. On files of other kinds (such as