Truncate a file: Difference between revisions

m
Added a general comment.
(Added 11l)
m (Added a general comment.)
Line 816:
 
=={{header|Nim}}==
Nim provides the module "posix" which allows to use the Posix functions in Nim programs. The behavior is that of the "truncate" Posix function. Especially, if the provided length is greater than the current file size, the file is expanded at the requested length with null bytes.
 
The function returns a code which can be checked to emit a message or raise an exception in case of error. In the following example, we ignore (discard) this return code.
 
<lang nim>import posix
 
Anonymous user