<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="AsciiDoc 8.6.10">
<title>MLtonIO</title>
<link rel="stylesheet" href="./asciidoc.css" type="text/css">
<link rel="stylesheet" href="./pygments.css" type="text/css">


<script type="text/javascript" src="./asciidoc.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
asciidoc.install();
/*]]>*/
</script>
<link rel="stylesheet" href="./mlton.css" type="text/css">
</head>
<body class="article">
<div id="banner">
<div id="banner-home">
<a href="./Home">MLton 20201002</a>
</div>
</div>
<div id="header">
<h1>MLtonIO</h1>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="listingblock">
<div class="content"><div class="highlight"><pre><span></span><span class="k">signature</span><span class="w"> </span><span class="n">MLTON_IO</span><span class="w"> </span><span class="p">=</span><span class="w"></span>
<span class="w">   </span><span class="k">sig</span><span class="w"></span>
<span class="w">      </span><span class="k">type</span><span class="w"> </span><span class="n">instream</span><span class="w"></span>
<span class="w">      </span><span class="k">type</span><span class="w"> </span><span class="n">outstream</span><span class="w"></span>

<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">inFd</span><span class="p">:</span><span class="w"> </span><span class="n">instream</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">Posix</span><span class="p">.</span><span class="n">IO</span><span class="p">.</span><span class="n">file_desc</span><span class="w"></span>
<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">mkstemp</span><span class="p">:</span><span class="w"> </span><span class="n">string</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">string</span><span class="w"> </span><span class="n">*</span><span class="w"> </span><span class="n">outstream</span><span class="w"></span>
<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">mkstemps</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="n">prefix</span><span class="p">:</span><span class="w"> </span><span class="n">string</span><span class="p">,</span><span class="w"> </span><span class="n">suffix</span><span class="p">:</span><span class="w"> </span><span class="n">string</span><span class="p">}</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">string</span><span class="w"> </span><span class="n">*</span><span class="w"> </span><span class="n">outstream</span><span class="w"></span>
<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">newIn</span><span class="p">:</span><span class="w"> </span><span class="n">Posix</span><span class="p">.</span><span class="n">IO</span><span class="p">.</span><span class="n">file_desc</span><span class="w"> </span><span class="n">*</span><span class="w"> </span><span class="n">string</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">instream</span><span class="w"></span>
<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">newOut</span><span class="p">:</span><span class="w"> </span><span class="n">Posix</span><span class="p">.</span><span class="n">IO</span><span class="p">.</span><span class="n">file_desc</span><span class="w"> </span><span class="n">*</span><span class="w"> </span><span class="n">string</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">outstream</span><span class="w"></span>
<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">outFd</span><span class="p">:</span><span class="w"> </span><span class="n">outstream</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">Posix</span><span class="p">.</span><span class="n">IO</span><span class="p">.</span><span class="n">file_desc</span><span class="w"></span>
<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">tempPrefix</span><span class="p">:</span><span class="w"> </span><span class="n">string</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">string</span><span class="w"></span>
<span class="w">   </span><span class="k">end</span><span class="w"></span>
</pre></div></div></div>
<div class="ulist"><ul>
<li>
<p>
<span class="monospaced">inFd ins</span>
</p>
<div class="paragraph"><p>returns the file descriptor corresponding to <span class="monospaced">ins</span>.</p></div>
</li>
<li>
<p>
<span class="monospaced">mkstemp s</span>
</p>
<div class="paragraph"><p>like the C <span class="monospaced">mkstemp</span> function, generates and open a temporary file
with prefix <span class="monospaced">s</span>.</p></div>
</li>
<li>
<p>
<span class="monospaced">mkstemps {prefix, suffix}</span>
</p>
<div class="paragraph"><p>like <span class="monospaced">mkstemp</span>, except it has both a prefix and suffix.</p></div>
</li>
<li>
<p>
<span class="monospaced">newIn (fd, name)</span>
</p>
<div class="paragraph"><p>creates a new instream from file descriptor <span class="monospaced">fd</span>, with <span class="monospaced">name</span> used in
any <span class="monospaced">Io</span> exceptions later raised.</p></div>
</li>
<li>
<p>
<span class="monospaced">newOut (fd, name)</span>
</p>
<div class="paragraph"><p>creates a new outstream from file descriptor <span class="monospaced">fd</span>, with <span class="monospaced">name</span> used in
any <span class="monospaced">Io</span> exceptions later raised.</p></div>
</li>
<li>
<p>
<span class="monospaced">outFd out</span>
</p>
<div class="paragraph"><p>returns the file descriptor corresponding to <span class="monospaced">out</span>.</p></div>
</li>
<li>
<p>
<span class="monospaced">tempPrefix s</span>
</p>
<div class="paragraph"><p>adds a suitable system or user specific prefix (directory) for temp
files.</p></div>
</li>
</ul></div>
</div>
</div>
</div>
<div id="footnotes"><hr></div>
<div id="footer">
<div id="footer-text">
</div>
<div id="footer-badges">
</div>
</div>
</body>
</html>
