Function Reference


_StreamCopyToEx

Copies bytes from one stream to another using IStream::Read and IStream::Write.

_StreamCopyToEx(ByRef $oSourceStream, ByRef $oDestStream, $iBytesToCopy, ByRef $iBytesRead, ByRef $iBytesWritten)

Parameters

$oSourceStream Source IStream COM object.
$oDestStream Destination IStream COM object.
$iBytesToCopy Number of bytes to copy.
$iBytesRead [out] Number of bytes read from the source.
$iBytesWritten [out] Number of bytes written to the destination.

Return Value

Success: 1
Failure: 0, sets @error to:
1 - Invalid source stream object.
2 - Invalid destination stream object.
3 - Failed to get source stream size.
4 - Failed to get destination stream size.
5 - Failed to set destination stream size.
6 - Failed to seek source stream.
7 - Failed to read from source stream.
8 - Failed to seek destination stream.
9 - Failed to write to destination stream.

Remarks

The destination stream is resized if necessary to accommodate the copied bytes. The caller is responsible for releasing both streams.

Related

_StreamRead, _StreamWrite, _StreamSeek, _StreamSetSize