ADO » Stream » CopyTo

Version: 2.5

streamobject.CopyTo DestStream, NumChars
The mandatory DestStream parameter is a reference to an open Stream object that is the destination. The destination Stream object must not be a proxy of the source Stream object.
The optional NumChars parameter is a long integer that is either the number of characters of text data or the number of bytes of binary data to be copied from the current position in the Stream. If the specified number is greater than the actual number of bytes or characters available from the current position to EOS in the source Stream, then only the available number of bytes or characters will be copied and no error will be generated. If this parameter is left blank or set to -1, the default is to copy all data from the current position to EOS.

Copies the specified number of characters or bytes from one Stream object to another Stream object.

The CopyTo method is used to copy binary or text data from a source Stream object into a destination Stream object. Both Stream objects must be open or an error will be generated. Ideally, the type (text or binary) of both the source and destination Stream objects should be the same. However, you can copy a text Stream object into a binary Stream object, but not vise-versa. The default is to copy all data from the current position to the end of the stream (EOS).

If there is existing data in the destination Stream object, it may not necessarily be completely overwritten during the copy. If the source copy data is smaller in size than the existing data at the destination, then the existing data that extends beyond the end of the copy will not be overwritten and will remain in the destination Stream.

This method has one mandatory and one optional parameter.

You can set the CharSet property of the destination Stream object to be different than the source and the text will be appropriately translated.


objMeditationStream.CharSet = "ascii"
objGuruStream.CopyTo objMeditationStream

See Also: