Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Truncate-a-file/Standard-ML/truncate-a-file.ml
Normal file
11
Task/Truncate-a-file/Standard-ML/truncate-a-file.ml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
local
|
||||
open Posix.FileSys
|
||||
val perm = S.flags [S.irusr, S.iwusr, S.irgrp, S.iwgrp, S.iroth, S.iwoth]
|
||||
in
|
||||
fun truncate (path, len) =
|
||||
let
|
||||
val fd = createf (path, O_WRONLY, O.noctty, perm)
|
||||
in
|
||||
ftruncate (fd, len); Posix.IO.close fd
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue