当前位置: 首页>>代码示例>>C++>>正文


C++ CDirectory::DirectoryScan方法代码示例

本文整理汇总了C++中CDirectory::DirectoryScan方法的典型用法代码示例。如果您正苦于以下问题:C++ CDirectory::DirectoryScan方法的具体用法?C++ CDirectory::DirectoryScan怎么用?C++ CDirectory::DirectoryScan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDirectory的用法示例。


在下文中一共展示了CDirectory::DirectoryScan方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CDirectory

bool CDirectory::dir2fdd(char *sourceDirectory, char *fddImageName)
{
    Debug::out(LOG_INFO, "CDirectory::dir2fdd() -- will try to create %s from %s", fddImageName, sourceDirectory);
    
   	CDirectory *pDir = new CDirectory();
	pDir->DirectoryScan(sourceDirectory);

    if(!pDir) {
        Debug::out(LOG_ERROR, "CreateTreeFromDirectory failed...");
        return false;
    }
    
    CFloppy floppy;
    floppy.Create(NB_HEAD,NB_SECTOR_PER_TRACK,NB_CYLINDER);

    bool bOk = floppy.Fill( pDir, (char *) "CONF_FDD" );

    if (bOk) {
        Debug::out(LOG_INFO, "CDirectory::dir2fdd() -- Writing file %s", fddImageName);
        floppy.WriteImage(fddImageName);
    }

    delete pDir;
	return bOk;
}
开发者ID:atarijookie,项目名称:ce-atari,代码行数:25,代码来源:cdirectory.cpp

示例2: DirectoryScan

void CDirectory::DirectoryScan(const char *pDir)
{
	char tmpName[_MAX_PATH];
	strcpy(tmpName,pDir);
	strcat(tmpName,"\\*.*");
	
	DIR *dir = opendir((char *) pDir);						        // try to open the dir
	
    if(dir == NULL) {                                 			    // not found?
        return;
    }
    
	while(1) {                                                  	// while there are more files, store them
		struct dirent *de = readdir(dir);							// read the next directory entry
	
		if(de == NULL) {											// no more entries?
			break;
		}
	
		if(de->d_type != DT_DIR && de->d_type != DT_REG) {			// not 	a file, not a directory?
			continue;
		}

		sprintf(tmpName,"%s/%s", pDir, de->d_name);

        if(de->d_type == DT_DIR) {                                  // for dir
            if(de->d_name[0] == '.') {                              // skip . and ..
                continue;
            }
            
            CDirectory *pNewDir = new CDirectory();
			this->AddEntry(de, pNewDir, tmpName);
            
			pNewDir->DirectoryScan(tmpName);
        } else {
            this->AddEntry(de, NULL, tmpName);
        }
    }

    closedir(dir);	
}
开发者ID:atarijookie,项目名称:ce-atari,代码行数:41,代码来源:cdirectory.cpp


注:本文中的CDirectory::DirectoryScan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。