IStream_Read function (shlwapi.h)

Reads bytes from a specified stream and returns a value that indicates whether all bytes were successfully read.


LWSTDAPI IStream_Read(
  [in]  IStream *pstm,
  [out] void    *pv,
  [in]  ULONG   cb


[in] pstm

Type: IStream*

A pointer to the IStream interface of the stream from which to read.

[out] pv

Type: VOID*

A pointer to a buffer to receive the stream data from pstm. This buffer must be at least cb bytes in size.

[in] cb


The number of bytes of data that the function should attempt to read from the input stream.

Return value


Returns S_OK if the function successfully reads the specified number of bytes from the stream, or a COM failure code otherwise. In particular, if the read attempt was successful but fewer than cb bytes were read, the function returns E_FAIL.


This function calls the ISequentialStream::Read method to read data from the specified stream into the buffer. If the function fails for any reason, the contents of the output buffer and the position of the read pointer in the input stream are undefined.


Minimum supported client Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server, Windows Server 2003 [desktop apps only]
Target Platform Windows
Header shlwapi.h
DLL Shlwapi.dll (version 5.0 or later)

See also