ISequentialStream::Read method

The Read method reads a specified number of bytes from the stream object into memory, starting at the current seek pointer.


  void  *pv,
  ULONG cb,
  ULONG *pcbRead



A pointer to the buffer which the stream data is read into.


The number of bytes of data to read from the stream object.


A pointer to a ULONG variable that receives the actual number of bytes read from the stream object.

Note  The number of bytes read may be zero.

Return Value

This method can return one of these values.


This method reads bytes from this stream object into memory. The stream object must be opened in STGM_READ mode. This method adjusts the seek pointer by the actual number of bytes read.

The number of bytes actually read is also returned in the pcbRead parameter.

Notes to Callers

The actual number of bytes read can be less than the number of bytes requested if an error occurs or if the end of the stream is reached during the read operation. The number of bytes returned should always be compared to the number of bytes requested. If the number of bytes returned is less than the number of bytes requested, it usually means the Read method attempted to read past the end of the stream.

The application should handle both a returned error and S_OK return values on end-of-stream read operations.


Minimum supported client Windows 2000 Professional [desktop apps | UWP apps]
Minimum supported server Windows 2000 Server [desktop apps | UWP apps]
Target Platform Windows
Header objidl.h
Library Uuid.lib
DLL Ole32.dll

See Also




IStream - Compound File Implementation