val stdout : tval stderr : ttype 'a with_create_args = ?binary:Stdio__.Import.bool ‑> ?append:Stdio__.Import.bool ‑> ?fail_if_exists:Stdio__.Import.bool ‑> ?perm:Stdio__.Import.int ‑> 'aval create : (Stdio__.Import.string ‑> t) with_create_argsval with_file : (Stdio__.Import.string ‑> f:(t ‑> 'a) ‑> 'a) with_create_argsval close : t ‑> Stdio__.Import.unitclose t flushes and closes t, and may raise an exception. close returns () and
does not raise if t is already closed. close raises an exception if the close()
system call on the underlying file descriptor fails (i.e. returns -1), which would
happen in the following cases:
EBADF -- this would happen if someone else did close() system call on the underlying fd, which I would think a rare event.
EINTR -- would happen if the system call was interrupted by a signal, which would be
rare. Also, I think we should probably just catch EINTR and re-attempt the close.
Unfortunately, we can't do that in OCaml because the OCaml library marks the
out_channel as closed even if the close syscall fails, so a subsequent call
close_out_channel will be a no-op. This should really be fixed in the OCaml library
C code, having it restart the close() syscall on EINTR. I put a couple CRs in
fixed_close_channel, our rework of OCaml's caml_ml_close_channel,
EIO -- I don't recall seeing this. I think it's rare.
See "man 2 close" for details.
val set_binary_mode : t ‑> Stdio__.Import.bool ‑> Stdio__.Import.unitval flush : t ‑> Stdio__.Import.unitval output : t ‑> buf:Stdio__.Import.string ‑> pos:Stdio__.Import.int ‑> len:Stdio__.Import.int ‑> Stdio__.Import.unitval output_string : t ‑> Stdio__.Import.string ‑> Stdio__.Import.unitval output_char : t ‑> Stdio__.Import.char ‑> Stdio__.Import.unitval output_byte : t ‑> Stdio__.Import.int ‑> Stdio__.Import.unitval output_binary_int : t ‑> Stdio__.Import.int ‑> Stdio__.Import.unitval output_buffer : t ‑> Stdio__.Import.Buffer.t ‑> Stdio__.Import.unitval newline : t ‑> Stdio__.Import.unitval output_lines : t ‑> Stdio__.Import.string Stdio__.Import.list ‑> Stdio__.Import.unitOutputs a list of lines, each terminated by a newline character
val fprintf : t ‑> ('a, t, Stdio__.Import.unit) Stdio__.Import.format ‑> 'aFormatted printing to an out channel. This is the same as Printf.sprintf except
that it outputs to t instead of returning a string. Similarly, the function
arguments corresponding to conversions specifications such as %a or %t takes t
as argument and must print to it instead of returning a string.
val printf : ('a, t, Stdio__.Import.unit) Stdio__.Import.format ‑> 'aprintf fmt is the same as fprintf stdout fmt
val eprintf : ('a, t, Stdio__.Import.unit) Stdio__.Import.format ‑> 'aprintf fmt is the same as fprintf stderr fmt
val kfprintf : (t ‑> 'a) ‑> t ‑> ('b, t, Stdio__.Import.unit, 'a) Stdio__.Import.format4 ‑> 'bkfprintf k t fmt is the same as fprintf t fmt, but instead of returning
immediately, passes the out channel to k at the end of printing.
val print_endline : Stdio__.Import.string ‑> Stdio__.Import.unitprint_endline str outputs str to stdout followed by a newline then flushes
stdout
val prerr_endline : Stdio__.Import.string ‑> Stdio__.Import.unitprerr_endline str outputs str to stderr followed by a newline then flushes
stderr
val seek : t ‑> Stdio__.Import.int64 ‑> Stdio__.Import.unitval pos : t ‑> Stdio__.Import.int64val length : t ‑> Stdio__.Import.int64val write_lines : Stdio__.Import.string ‑> Stdio__.Import.string Stdio__.Import.list ‑> Stdio__.Import.unitThe first argument of these is the file name to write to.
val write_all : Stdio__.Import.string ‑> data:Stdio__.Import.string ‑> Stdio__.Import.unit