Truncate a file: Difference between revisions

added ocaml
m (→‎{{header|UNIX Shell}}: Complete my sentence.)
(added ocaml)
Line 130:
}
}</lang>
 
=={{header|OCaml}}==
 
The <code>Unix</code> module provided with the standard distribution provides a function <code>[http://caml.inria.fr/pub/docs/manual-ocaml/libref/Unix.html#VALtruncate truncate]</code>:
 
<lang ocaml>val truncate : string -> int -> unit
(** Truncates the named file to the given size. *)</lang>
 
There is also a function <code>[http://caml.inria.fr/pub/docs/manual-ocaml/libref/Unix.html#VALftruncate ftruncate]</code> that does the equivalent operation but with a file descriptor instead of a file name:
 
<lang ocaml>val ftruncate : file_descr -> int -> unit
(** Truncates the file corresponding to the given descriptor to the given size. *)</lang>
 
=={{header|PureBasic}}==