Поделиться через


IInputStream::ReadAsync method

Creates an asynchronous byte reader operation object.

Syntax

HRESULT ReadAsync(
  [in]          IBuffer                                        buffer,
  [in]          UINT32                                         count,
                InputStreamOptions                             options,
  [out, retval] IAsyncOperationWithProgress<IBuffer *, UINT32> **operation
);

Parameters

  • buffer [in]
    A suggested buffer to use for the operation. The ReadAsync method may provide a different IBuffer when needed. Bytes are read into the appropriate buffer and this is the one that's actually returned as the output parameter. Use the IBuffer resulting from the completion of the async operation to retrieve the bytes read, because buffer may not contain the bytes.

  • count [in]
    The number of bytes to read, which must be less than or equal to the Capacity property of buffer.

  • options
    The type of asynchronous read operation.

  • operation [out, retval]
    The asynchronous operation for reading the byte stream.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

Call the Start method on operation to start reading. Once started, the operation reads bytes from the input stream, and writes these bytes into the IBuffer resulting from the completion of the async operation. When the read operation completes, the stream sets the buffer’s Length property to the number of bytes read.

Calling the ReadAsync method multiple times before all preceding read operations have completed produces unspecified and non-deterministic results.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Header

Robytestream.h

IDL

Robytestream.idl

See also

IInputStream

InputStreamOptions

IOutputStream

WriteAsync