read sequence of chars from a channel

This commit is contained in:
Simon Cruanes 2013-02-04 23:28:02 +01:00
parent 74fb0a4725
commit 28332a45df
2 changed files with 8 additions and 0 deletions

View file

@ -192,6 +192,12 @@ module String =
let b = Buffer.create 64 in
iter (fun c -> Buffer.add_char b c) seq;
Buffer.contents b
let of_in ic =
from_iter (fun k ->
try while true do
let c = input_char ic in k c
done with End_of_file -> ())
end
module Int =

View file

@ -144,6 +144,8 @@ module String :
sig
val to_seq : string -> char t
val of_seq : char t -> string
val of_in : in_channel -> char t
end
(** Sequences of ints *)