Jump to content

Truncate a file: Difference between revisions

(Added Kotlin)
Line 434:
Cannot open file "<File name with full path>. The system cannot find the file specified.
=={{header|Elena}}==
<lang elena>#import system'io.
#import extensions.
file_info extension(file_path) fileOp
{
set &length:length
[
stream stream := FileStream openForEdit &path:self.
stream set &length:length.
stream close.
Line 452:
[
if ('program'arguments length != 3)
[ console << printLine:"Please provide the path to the file and a new length". AbortException new; raise. ].
varfile_info fileNamefile := File new('program'arguments@[1]).
var length := ('program'arguments@[2)] toInt.
ifnot (fileNamefile file_path is &availableisAvailable)
[ console writeLine:printLine("File ":fileName:,file," does not exist"). AbortException new; raise. ].
fileName file_pathfile set &length:length.
].</lang>
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.