Syntax
| streamobject.CopyTo DestStream[, NumChars]
| ||||||
---|---|---|---|---|---|---|---|
Description
| 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.
| ||||||
See Also
| |||||||
Example
| objStream2.CharSet = "ascii"
objStream.CopyTo objStream2
|