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