LPCTSTR CFileText::GetModeStr() const { // end of line translation is crap. ftell and fseek don't work correctly when you use it. // fopen() args if ( IsBinaryMode()) return ( IsWriteMode()) ? "wb" : "rb"; if ( GetMode() & OF_READWRITE ) return "a+b"; if ( GetMode() & OF_CREATE ) return "w"; if ( IsWriteMode() ) return "w"; else return "rb"; // don't parse out the \n\r }
void CFileText::CloseBase() { if ( IsWriteMode()) { fflush(m_pStream); } bool fSuccess = ( fclose( m_pStream ) == 0 ); DEBUG_CHECK( fSuccess ); m_pStream = NULL; }
void CResourceLock::CloseBase() { ADDTOCALLSTACK("CResourceLock::CloseBase"); ASSERT(m_pLock); m_pStream = NULL; // Assume this is not the context anymore. m_PrvScriptContext.Close(); if ( m_PrvLockContext.IsValid()) { m_pLock->SeekContext(m_PrvLockContext); // no need to set the line number as it should not have changed. } // Restore old position in the file (if there was one) m_pLock->Close(); // decrement open count on the orig. if( IsWriteMode() || ( GetFullMode() & OF_DEFAULTMODE )) { Init(); } }