mirror of
https://github.com/c-cube/iter.git
synced 2025-12-07 03:35:32 -05:00
2 lines
No EOL
4.2 KiB
HTML
2 lines
No EOL
4.2 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>IO (sequence.SequenceLabels.IO)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> – <a href="../../index.html">sequence</a> » <a href="../index.html">SequenceLabels</a> » IO</nav><h1>Module <code>SequenceLabels.IO</code></h1></header><dl><dt class="spec value" id="val-lines_of"><a href="#val-lines_of" class="anchor"></a><code><span class="keyword">val</span> lines_of : ?⁠mode:int <span>-></span> ?⁠flags:Pervasives.open_flag list <span>-></span> string <span>-></span> string <a href="../index.html#type-t">t</a></code></dt><dd><p><code>lines_of filename</code> reads all lines of the given file. It raises the same exception as would opening the file and read from it, except from <code>End_of_file</code> (which is caught). The file is <b>always</b> properly closed. Every time the sequence is iterated on, the file is opened again, so different iterations might return different results</p><dl><dt>parameter mode</dt><dd><p>default <code>0o644</code></p></dd></dl><dl><dt>parameter flags</dt><dd><p>default: <code>[Open_rdonly]</code></p></dd></dl></dd></dl><dl><dt class="spec value" id="val-chunks_of"><a href="#val-chunks_of" class="anchor"></a><code><span class="keyword">val</span> chunks_of : ?⁠mode:int <span>-></span> ?⁠flags:Pervasives.open_flag list <span>-></span> ?⁠size:int <span>-></span> string <span>-></span> string <a href="../index.html#type-t">t</a></code></dt><dd><p>Read chunks of the given <code>size</code> from the file. The last chunk might be smaller. Behaves like <a href="index.html#val-lines_of"><code>lines_of</code></a> regarding errors and options. Every time the sequence is iterated on, the file is opened again, so different iterations might return different results</p></dd></dl><dl><dt class="spec value" id="val-write_to"><a href="#val-write_to" class="anchor"></a><code><span class="keyword">val</span> write_to : ?⁠mode:int <span>-></span> ?⁠flags:Pervasives.open_flag list <span>-></span> string <span>-></span> string <a href="../index.html#type-t">t</a> <span>-></span> unit</code></dt><dd><p><code>write_to filename seq</code> writes all strings from <code>seq</code> into the given file. It takes care of opening and closing the file.</p><dl><dt>parameter mode</dt><dd><p>default <code>0o644</code></p></dd></dl><dl><dt>parameter flags</dt><dd><p>used by <code>open_out_gen</code>. Default: <code>[Open_creat;Open_wronly]</code>.</p></dd></dl></dd></dl><dl><dt class="spec value" id="val-write_bytes_to"><a href="#val-write_bytes_to" class="anchor"></a><code><span class="keyword">val</span> write_bytes_to : ?⁠mode:int <span>-></span> ?⁠flags:Pervasives.open_flag list <span>-></span> string <span>-></span> Bytes.t <a href="../index.html#type-t">t</a> <span>-></span> unit</code></dt><dd><dl><dt>since</dt><dd>0.5.4</dd></dl></dd></dl><dl><dt class="spec value" id="val-write_lines"><a href="#val-write_lines" class="anchor"></a><code><span class="keyword">val</span> write_lines : ?⁠mode:int <span>-></span> ?⁠flags:Pervasives.open_flag list <span>-></span> string <span>-></span> string <a href="../index.html#type-t">t</a> <span>-></span> unit</code></dt><dd><p>Same as <a href="index.html#val-write_to"><code>write_to</code></a>, but intercales <code>'\n'</code> between each string</p></dd></dl><dl><dt class="spec value" id="val-write_bytes_lines"><a href="#val-write_bytes_lines" class="anchor"></a><code><span class="keyword">val</span> write_bytes_lines : ?⁠mode:int <span>-></span> ?⁠flags:Pervasives.open_flag list <span>-></span> string <span>-></span> Bytes.t <a href="../index.html#type-t">t</a> <span>-></span> unit</code></dt><dd><dl><dt>since</dt><dd>0.5.4</dd></dl></dd></dl></div></body></html> |