Compartilhar via


ISequentialStream::Write (Windows CE 5.0)

Send Feedback

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

HRESULT Write(void const* pv,ULONG cb,ULONG* pcbWritten);

Parameters

  • pv
    [in] Pointer to the buffer containing the data that is to be written to the stream. A valid pointer must be provided for this parameter even when cb is zero.
  • cb
    [in] The number of bytes of data to attempt to write into the stream. Can be zero.
  • pcbWritten
    [out] Pointer to a ULONG variable where this method writes the actual number of bytes written to the stream object. The caller can set this pointer to NULL, in which case this method does not provide the actual number of bytes written.

Return Values

  • S_OK
    The data was successfully written to the stream object.
  • E_PENDING
    Asynchronous Storage only: Part or all of the data to be written is currently unavailable. For more information see IFillLockBytes and Asynchronous Storage.
  • STG_E_MEDIUMFULL
    The write operation was not completed because there is no space left on the storage device.
  • STG_E_ACCESSDENIED
    The caller does not have enough permissions for writing to this stream object.
  • STG_E_CANTSAVE
    Data cannot be written for reasons other than improper access or insufficient space.
  • STG_E_INVALIDPOINTER
    One of the pointer values is not valid. The pv parameter must contain a valid pointer even if cb is zero.
  • STG_E_REVERTED
    The object has been invalidated by a revert operation above it in the transaction tree.
  • STG_E_WRITEFAULT
    The write operation was not completed due to a disk error. This value is also returned when this method attempts to write to a stream that was opened in simple mode (using the STGM_SIMPLE flag).

Remarks

ISequentialStream::Write writes the specified data to a stream object. The seek pointer is adjusted for the number of bytes actually written. The number of bytes actually written is returned in the pcbWritten parameter. If the byte count is zero bytes, the write operation has no effect.

If the seek pointer is currently past the end of the stream and the byte count is nonzero, this method increases the size of the stream to the seek pointer and writes the specified bytes starting at the seek pointer.

The fill bytes written to the stream are not initialized to any particular value. This is the same as the end-of-file behavior in the MS-DOS FAT file system.

With a zero byte count and a seek pointer past the end of the stream, this method does not create the fill bytes to increase the stream to the seek pointer. In this case, you must call the IStream::SetSize method to increase the size of the stream and write the fill bytes.

The pcbWritten parameter can have a value even if an error occurs.

In the COM-provided implementation, stream objects are not sparse. Any fill bytes are eventually allocated on the disk and assigned to the stream.

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Requirements

OS Versions: Windows CE 3.0 and later.
Header: Objidl.h, Objidl.idl.
Link Library: Ole32.lib, Uuid.lib.

See Also

ISequentialStream::Read | IStorage::OpenStream | IStream

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.