Class CFileLog::
Initialize()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: ~CFileLogNext page: operator =    Show member index
Public Function Declared in:
FileLog.h

'Declaration' icon -- Shortcut to top of page. Declaration

BOOL Initialize(
    const std::string& rFileName);

'Description' icon -- Shortcut to top of page. Description

Initialize the log

'Function Body' icon -- Shortcut to top of page. Function Body

//Open's the log file
try
{
    //Check if the file is open
    if (m_pFile)
        //close is
        fclose(m_pFile);

    //Which open mode
    BOOL bTruncate;
    bTruncate=FALSE;

    //Do we need to get the file size
    if (m_dwMaxLogSize)
    {
        //Open the file
        HANDLE hFile;
        hFile=CreateFile(rFileName.c_str(),
                         GENERIC_READ,
                         FILE_SHARE_READ,
                         NULL,
                         OPEN_EXISTING,
                         FILE_ATTRIBUTE_NORMAL,
                         NULL);

        //Do we have it?
        if (hFile!=INVALID_HANDLE_VALUE)
        {
            //Get the file size
            DWORD dwSize;
            dwSize=GetFileSize(hFile,
                               NULL);

            //Close the file
            CloseHandle(hFile);

            //Is it bigger
            if (dwSize>m_dwMaxLogSize)
                bTruncate=FALSE;
        }
    }

    //Now open the file
    if (!bTruncate)
        m_pFile=fopen(rFileName.c_str(),"at");
    else
        m_pFile=fopen(rFileName.c_str(),"wt");

    //Did we manage to open it?
    if (!m_pFile)
        return FALSE;
    else
        return TRUE;
}
ERROR_UNKNOWN_RETURN("ReportError",FALSE)

'See Also' icon -- Shortcut to top of page. See Also

Class Overview Class Overview  |  Public base class CErrorHandler::CErrorLog  |  Hierarchy Chart Hierarchy Chart


Get Surveyor!This web site was generated using Surveyor V4.50.811.1.  Click here for more information. Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003.