ADO » Stream » Read

Version: 2.5

variant = streamobject.Read (NumBytes)
The optional NumBytes parameter is either the number of bytes to read or one of the StreamReadEnum constants. If you specify a number larger than the actual number of bytes available in the Stream, only the actual available bytes are read and no error is generated. A null value is returned if there are no bytes left to be read.

Reads the specified number of bytes from a binary Stream object andreturns the data as a variant.

The Read method is used to read an entire binary file or a specified number of bytes from a Stream object and to return the data as a variant.

This method is used exclusively for binary data type Stream objects. Please use the similar ReadText method for text data type Stream objects.

There is one optional parameter.
StreamReadEnum Constants

Constant Value Description
adReadAll -1 Default, read from the current position to EOS
adReadLine -2 Only read until the end of the current line


Dim intNumBytes, varStreamRead
intNumBytes = 4096
varStreamRead = objStream.Read intNumBytes

See Also: