This is a simple way of making a progressbar possible.
Its just CopyFile() and CopyStream() slapped together with a callback, note the size of the buffer (4096) will dictate how often the callback gets called.
Its just CopyFile() and CopyStream() slapped together with a callback, note the size of the buffer (4096) will dictate how often the callback gets called.
CopyFileProgress( "infile", "outfile", progress) Function progress( pos:Int,size:Int) Print pos +" < " + size EndFunction Function CopyFileProgress:Int( src:String,dst:String, callback(pos:Int,size:Int)) If Not callback Then Return CopyFile( src,dst) Local in:TStream = ReadStream( src), ok:Int If in Then Local out:TStream = WriteStream( dst ) If out Then Local buf:Byte[4096] Try While Not in.Eof() callback( in.Pos(), in.Size()) out.WriteBytes buf,in.Read( buf,buf.Length) Wend callback( in.Pos(), in.Size()) ok = True Catch ex:TStreamWriteException EndTry out.Close() EndIf in.Close() EndIf Return ok EndFunction