Truncate a file: Difference between revisions

Line 411:
Cannot open file "<File name with full path>. The system cannot find the file specified.
=={{header|Elena}}==
<lang elena>#import system'io.
#import system'io.
#import extensions.
 
#class(extension:(file_path) fileOp
{
#method set &length:length
[
#var(type:stream) stream := FileStream openForEdit &path:self.
stream set &length:length.
stream close.
]
}
 
#symbol program =
[
if ('program'arguments length != 3)?
[ console << "Please provide the path to the file and a new length". #throw AbortException new raise. ].
 
#var fileName := 'program'arguments@1.
#var length := ('program'arguments@2) toInt.
ifnot (fileName file_path is &available)
! [ console writeLine:"File ":fileName:" does not exist". #throw AbortException new raise. ].
fileName file_path set &length:length.
].</lang>
Anonymous user