Writes a specified number of bytes into the stream object starting at the current read/write location within the stream.
HRESULT Write(
Void const * pv, //Pointer to buffer into which the stream
is written
ULONG cb, //Specifies the number of bytes to write
ULONG * pcbWritten); // Specifies the actual number of
bytes written
Parameters
pv
[in]
Points to the buffer from which the stream should be written.
cb
[in]
The number of bytes of data to attempt to write into the stream.
pcbWritten
[out]
Pointer to a location 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 Code
S_OK
The data was successfully written into 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 sufficient permissions for writing this stream object.
STG_E_CANTSAVE
Data cannot be written for reasons other than lack of access or space.
STG_E_INVALIDPOINTER
One of the pointer values is invalid.
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.
Comments
ISequentialStream::Write writes the specified data to a stream object. The current read/write location within the stream is adjusted for the number of bytes actually written. The number of bytes actually written is returned in the pcbWrite parameter. If the byte count is zero bytes, the write operation has no effect.
The pcbWrite parameter can have a value even if an error occurs.