summaryrefslogtreecommitdiff
path: root/stdlib/stdlib.mli
diff options
context:
space:
mode:
authorXavier Leroy <xavierleroy@users.noreply.github.com>2020-09-08 09:52:22 +0200
committerGitHub <noreply@github.com>2020-09-08 09:52:22 +0200
commit1b48b5aa3c5b4e0320231ac182d49197ac930b63 (patch)
tree3090a047929e5c9e27b3c7bc6b59fa844177847a /stdlib/stdlib.mli
parent0c8e78268821b4949b8574bb1e8ddafa73d19aa7 (diff)
parent83c762974bdb32fe4cb80361bfe2a0d35ba71a05 (diff)
downloadocaml-1b48b5aa3c5b4e0320231ac182d49197ac930b63.tar.gz
Merge pull request #9872 from xavierleroy/seek-text-channels
Revised {in,out}_channel_length and seek_in for channels in text mode
Diffstat (limited to 'stdlib/stdlib.mli')
-rw-r--r--stdlib/stdlib.mli16
1 files changed, 14 insertions, 2 deletions
diff --git a/stdlib/stdlib.mli b/stdlib/stdlib.mli
index 7d7b56f44b..8afb798d69 100644
--- a/stdlib/stdlib.mli
+++ b/stdlib/stdlib.mli
@@ -998,7 +998,13 @@ val seek_out : out_channel -> int -> unit
val pos_out : out_channel -> int
(** Return the current writing position for the given channel. Does
not work on channels opened with the [Open_append] flag (returns
- unspecified results). *)
+ unspecified results).
+ For files opened in text mode under Windows, the returned position
+ is approximate (owing to end-of-line conversion); in particular,
+ saving the current position with [pos_out], then going back to
+ this position using [seek_out] will not work. For this
+ programming idiom to work reliably and portably, the file must be
+ opened in binary mode. *)
val out_channel_length : out_channel -> int
(** Return the size (number of characters) of the regular file
@@ -1113,7 +1119,13 @@ val seek_in : in_channel -> int -> unit
files of other kinds, the behavior is unspecified. *)
val pos_in : in_channel -> int
-(** Return the current reading position for the given channel. *)
+(** Return the current reading position for the given channel. For
+ files opened in text mode under Windows, the returned position is
+ approximate (owing to end-of-line conversion); in particular,
+ saving the current position with [pos_in], then going back to this
+ position using [seek_in] will not work. For this programming
+ idiom to work reliably and portably, the file must be opened in
+ binary mode. *)
val in_channel_length : in_channel -> int
(** Return the size (number of characters) of the regular file