mirror of
https://github.com/c-cube/iter.git
synced 2025-12-06 11:15:32 -05:00
read sequence of chars from a channel
This commit is contained in:
parent
74fb0a4725
commit
28332a45df
2 changed files with 8 additions and 0 deletions
|
|
@ -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 =
|
||||
|
|
|
|||
|
|
@ -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 *)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue