Name

Stream.Read Method — (Versions 2.5, 2.6)

Synopsis

bytes = stream.Read (NumBytes)

The Read method reads a number of bytes from a binary stream.

Arguments

NumBytes (Long or StreamReadEnum)

Optional. Specifies the number of bytes to read from the binary stream. The default value is adReadAll, which returns all the remaining bytes in the stream.

Returns

Variant (array)

Description

The Read method is used to read binary streams (Stream.Type property is equal to adTypeBinary), while the ReadText method is used to read textual streams (Stream.Type property is equal to adTypeText).

The return value is a Variant array of bytes, which will equal the number of bytes requested or the number of remaining bytes in the stream if the number of remaining bytes is less than the requested number of bytes. If there is no data to return, a Null Variant value is returned.

See Also

Stream.ReadText Method, Stream.Type Property, StreamReadEnum Enumeration

Get ADO: ActiveX Data Objects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.