file::Flush

Description

Force data remaining in the file buffer to be written to the file.

Syntax

BOOL Flush( )

Parameters

Return

TRUE for success and FALSE for error.

Examples

EX1

void file_Flush_ex1()
{
    string strFile = "C:\\test.txt";
    file ff;
    if( ff.Open(strFile, file::modeCreate | file::modeWrite) )
    {
        LPCSTR lpczFile = strFile;
        ff.Write(&lpczFile, strFile.GetLength()); // Write the file name into the file.
        ff.Flush(); // Make sure the file buffer has been written into the file.
        ff.Close();
    }
}

Remark

See Also

file::Write

header to Include

origin.h