![]() |
Initialize() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Public Function |
Declared in: FileLog.h |
BOOL Initialize( const std::string& rFileName);
Initialize the log
//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)
![]() |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |