Storages & Files CopyTo
CopyTo method

Copies the entire stream or portion of it to the target stream.

Syntax:

variable = object.CopyTo( stream, cbBytes)

Parameters:

stream - the Target stream. May be SFStream or object that supports IStream interface.

cbBytes - Bytes to copy to the target stream.

returned value: The actual number of bytes copied.

Examples:

Set sf = Server.CreateObject("newObjects.utilctls.SFMain")
Set file = sf.OpenFile("C:\SomeFile.bin")
Set mem = sf.CreateMemoryStream
' Copy part of the file to the memory stream
file.Pos = 100
n = file.CopyTo(mem,100)
' Copies 100 bytes beginning from the 100-th byte in the
' source stream.
Set sf = Server.CreateObject("newObjects.utilctls.SFMain")
Set file = sf.OpenFile("C:\SomeFile.bin")
Set mem = sf.CreateMemoryStream
' Copy the entire stream to the memory stream
n = file.CopyTo(mem,file.Size)

Remarks:

This method can be used for fast transfer of data between different streams.

Used to copy streams from different storages - for example file to a stream in an OLE file etc.

Applies to: SFStream object

newObjects Copyright 2001-2006 newObjects [ ]