Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / src / MLtonIO.adoc
CommitLineData
7f918cf1
CE
1MLtonIO
2=======
3
4[source,sml]
5----
6signature MLTON_IO =
7 sig
8 type instream
9 type outstream
10
11 val inFd: instream -> Posix.IO.file_desc
12 val mkstemp: string -> string * outstream
13 val mkstemps: {prefix: string, suffix: string} -> string * outstream
14 val newIn: Posix.IO.file_desc * string -> instream
15 val newOut: Posix.IO.file_desc * string -> outstream
16 val outFd: outstream -> Posix.IO.file_desc
17 val tempPrefix: string -> string
18 end
19----
20
21* `inFd ins`
22+
23returns the file descriptor corresponding to `ins`.
24
25* `mkstemp s`
26+
27like the C `mkstemp` function, generates and open a temporary file
28with prefix `s`.
29
30* `mkstemps {prefix, suffix}`
31+
32like `mkstemp`, except it has both a prefix and suffix.
33
34* `newIn (fd, name)`
35+
36creates a new instream from file descriptor `fd`, with `name` used in
37any `Io` exceptions later raised.
38
39* `newOut (fd, name)`
40+
41creates a new outstream from file descriptor `fd`, with `name` used in
42any `Io` exceptions later raised.
43
44* `outFd out`
45+
46returns the file descriptor corresponding to `out`.
47
48* `tempPrefix s`
49+
50adds a suitable system or user specific prefix (directory) for temp
51files.