ISequentialStream::Read

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

HRESULT Read(
void *pv,
ULONG cb,
ULONG *pcbRead );

Parameters

  • pv
    [out] Pointer to the buffer into which the stream data is read. If an error occurs, this value is NULL.
  • cb
    [in] Specifies the number of bytes of data to attempt to read from the stream object.
  • pcbRead
    [out] Pointer to a ULONG variable that receives the actual number of bytes read from the stream object. You can set this pointer to NULL to indicate that you are not interested in this value. In this case, this method does not provide the actual number of bytes read.

Return Values

  • S_OK
    Data was successfully read from the stream object.
  • S_FALSE
    The data could not be read from the stream object.
  • E_PENDING
    Asynchronous storage only: Part or all of the data to be read is currently unavailable. For more information, see IFillLockBytes.
  • STG_E_ACCESSDENIED
    The caller does not have enough permissions for reading this stream object.
  • STG_E_INVALIDPOINTER
    One of the pointer values is not valid.
  • STG_E_REVERTED
    The object has been invalidated by a revert operation above it in the transaction tree.

Remarks

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.

Some implementations might return an error if the end of the stream is reached during the read operation. You must be prepared to deal with the error return or S_OK return values on end-of-stream read operations.

Requirements

Runs On Versions Defined in Include Link to
Windows CE OS 3.0 and later Objidl.h    

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

ISequentialStream::Write, IStorage::OpenStream, IStream

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.