FILE.STREAM_COPY Function
Syntax
Arguments
- stream_fromPointer
A file pointer or socket pointer.
- stream_toPointer
A file pointer or socket pointer.
- controlPointer
A pointer with two elements:
- bytesNumeric
A running count of how many bytes have been streamed so far. It does not matter what you set this to, it gets reset to 0 at the beginning of the stream operation and it automatically updated as the stream progresses. This can be used to implement a progress bar.
- exitLogical
A logical flag. If it is set to .t., the stream operation will abort. This can be used to implement a cancel button
- chunksizeNumeric
Indicates the size of the chunks in which the stream is transferred.
- max_lengthNumeric
Indicates the maximum bytes that should be streamed. The operation will stop if it reaches this size, even if there is more data available.
Description
Perform a streamed copy - control variables include .exit and .bytes .
Discussion
Streaming is a faster, optimized way of copying. The FILE.STREAM_COPY() method copies data from a file or socket to a file or socket.
Example
dim pControl as P dim pControl.bytes as N = 0 dim pControl.exit as L = .f. f1 = FILE.open("c:\somefile.ext",FILE_RO_SHARED) f2 = FILE.create("c:\newfile.ext",FILE_RW_EXCLUSIVE) FILE.stream_copy(f1, f2, pControl)
See Also