다음을 통해 공유


Flush

 

Flushes whatever is in the buffer to the underlying stream and then flushes the underlying stream.

Syntax

  
HRESULT Flush ();  

Return Value

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 may 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 use of 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;  
}  

For an example of the Flush method, see Write an XML Document using XmlLite.

Requirements

Header: XmlLite.h

Library: XmlLite.lib

See Also

IXmlWriter Methods
Source: XmlLiteWriter.cpp