You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 7136 Reporter:@yallop Assigned to:@gasche Status: closed (set by @xavierleroy on 2017-09-24T15:31:48Z) Resolution: duplicate Priority: normal Severity: minor Fixed in version: 4.03.0+dev / +beta1 Category: standard library Duplicate of:#6719
Bug description
The documentation for Buffer.add_channel says:
Raise [End_of_file] if the channel contains fewer than [n]
characters. In this case, the characters are still added to
the buffer, so as to avoid loss of data.
However, when End_of_file is raised the characters are not added to the buffer:
$ cat abc.txt
abc
$ ocaml
OCaml version 4.02.3
let buf = Buffer.create 10;;
val buf : Buffer.t =
Buffer.add_channel buf (open_in "abc.txt") 10;;
Exception: End_of_file.
Buffer.contents buf;;
: string = ""
The text was updated successfully, but these errors were encountered:
add_channel b ic n reads exactly n character from the input channel ic and stores them at the end of buffer b. Raise End_of_file if the channel contains fewer than n characters.
Original bug ID: 7136
Reporter: @yallop
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2017-09-24T15:31:48Z)
Resolution: duplicate
Priority: normal
Severity: minor
Fixed in version: 4.03.0+dev / +beta1
Category: standard library
Duplicate of: #6719
Bug description
The documentation for Buffer.add_channel says:
Raise [End_of_file] if the channel contains fewer than [n]
characters. In this case, the characters are still added to
the buffer, so as to avoid loss of data.
However, when End_of_file is raised the characters are not added to the buffer:
$ cat abc.txt
abc
$ ocaml
OCaml version 4.02.3
let buf = Buffer.create 10;;
val buf : Buffer.t =
Buffer.add_channel buf (open_in "abc.txt") 10;;
Exception: End_of_file.
Buffer.contents buf;;
The text was updated successfully, but these errors were encountered: