Share via


Flush (Compact 7)

3/12/2014

This method flushes the buffer contents to the underlying stream and then flushes the underlying stream.

Syntax

HRESULT Flush ();

Return Value

This method returns S_OK if no error is generated.

Remarks

If the flush operation fails, this typically indicates an error in the underlying stream. In this case, the writer might not be in a recoverable state.

If the output stream for the writer is an IStream interface, this method will also flush the underlying stream by calling the IStream.Commit Method of the output stream.

The following code shows the Flush method:

// This code is excerpted from XmlLiteWriter.cpp.
if (FAILED(hr = pWriter->WriteEndDocument()))
{
    wprintf(L"Error, Method: WriteEndDocument, error is %08.8lx", hr);
    return -1;
}
if (FAILED(hr = pWriter->Flush()))
{
    wprintf(L"Error, Method: Flush, error is %08.8lx", hr);
    return -1;
}

See Also

Reference

IXmlWriter Methods
IStream
IXmlWriter Properties