Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,7 @@
let write_7bit_string ~filename ~str =
let oc = open_out filename in
let ob = IO.output_bits(IO.output_channel oc) in
String.iter (fun c -> IO.write_bits ob 7 (int_of_char c)) str;
IO.flush_bits ob;
close_out oc;
;;

View file

@ -0,0 +1,10 @@
let read_7bit_string ~filename =
let ic = open_in filename in
let ib = IO.input_bits(IO.input_channel ic) in
let buf = Buffer.create 2048 in
try while true do
let c = IO.read_bits ib 7 in
Buffer.add_char buf (char_of_int c);
done; ""
with IO.No_more_input ->
(Buffer.contents buf)