IStream_Write

This function writes to a stream, with partial writes treated as failure.

Declaration

HRESULT
IStream_Write (
    IStream *pstm,
    const void *pv,
    ULONG cb);

Parameters

The pstm argument provides the address of an IStream interface to some stream object.

The pv argument provides the address of a buffer to write from.

The cb argument provides the number of bytes to write.

Return Value

The function returns zero for success, else an error code.

Behaviour

The function calls the given stream’s Write method. If this method succeeds but does not write the whole amount wanted, then the function fails, with E_FAIL as the error code.

Availability

The IStream_Write function is exported from SHLWAPI as ordinal 212 in version 5.00 and higher.

Though this function dates from as long ago as 1999, it was still not documented by Microsoft in the MSDN Library at least as late as the CD edition dated January 2004.

However, the function did eventually get documented, apparently sometime in 2006. This article now conforms to Microsoft’s nomenclature.