HRESULT CProteinSurfaceBase::CreateAdjacentVertex(){ char drive[_MAX_DRIVE]; char dir[_MAX_DIR]; char fname[_MAX_FNAME]; char ext[_MAX_EXT]; _splitpath(m_pPDB->m_strFilename, drive, dir, fname, ext ); CString strSurfaceDir = GetMainApp()->m_strBaseSurfacePath; CString outputName; outputName.Format ( _T("%s%s_%02d_%c_%03d_%.2f_%d_%d_%d") , strSurfaceDir, fname, m_modelID, m_chainID, m_arrayAtom.size(), m_probeSphere, m_surfaceQuality, m_bAddHETATM, GetTypeGenSurface() ); CString outputFilenameAdjacentVertex = outputName + _T(".Adjacent"); BOOL bExistSurface = FALSE; HANDLE fileAdjacent = CreateFile( outputFilenameAdjacentVertex, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL ); if( INVALID_HANDLE_VALUE != fileAdjacent ) { bExistSurface = TRUE; } if ( fileAdjacent != INVALID_HANDLE_VALUE ) CloseHandle(fileAdjacent); BOOL bReadSuccess = FALSE; if ( bExistSurface == TRUE ) { CFile fileAdjacentVertex; CFileException ex; if ( fileAdjacentVertex.Open(outputFilenameAdjacentVertex, CFile::modeRead, &ex) ) { TCHAR buffHeader[512] = {0,}; fileAdjacentVertex.Read(buffHeader, _tcslen(SURFACE_CURVATURE_HEADER)); if ( CString(SURFACE_CURVATURE_HEADER) == CString(buffHeader) ) { long numArray; fileAdjacentVertex.Read(&numArray, sizeof(long)); m_ArrayArrayAdjacentVertex.clear(); m_ArrayArrayAdjacentVertex.resize(numArray); long iProgress = GetMainActiveView()->InitProgress(100); for ( int i = 0 ; i < m_ArrayArrayAdjacentVertex.size(); i++ ) { if ( i % (m_ArrayArrayAdjacentVertex.size()/100) == 0 ) GetMainActiveView()->SetProgress(i*100/m_ArrayArrayAdjacentVertex.size(), iProgress); CSTLLONGArray & arrayAdjacentVertex = m_ArrayArrayAdjacentVertex[i]; long numAdjacentVertex; fileAdjacentVertex.Read(&numAdjacentVertex, sizeof(long)); arrayAdjacentVertex.resize(numAdjacentVertex); fileAdjacentVertex.Read(&arrayAdjacentVertex[0], sizeof(long)*numAdjacentVertex); } GetMainActiveView()->EndProgress(iProgress); fileAdjacentVertex.Close(); if ( m_ArrayArrayAdjacentVertex.size() == i ) bReadSuccess = TRUE; } } } if ( bReadSuccess == FALSE ) { // setArrayAdjacentVertex
C++ CreateFileA函数代码示例
C++ CreateEx函数代码示例