當前位置: 首頁>>代碼示例>>C++>>正文


C++ FindFile函數代碼示例

本文整理匯總了C++中FindFile函數的典型用法代碼示例。如果您正苦於以下問題:C++ FindFile函數的具體用法?C++ FindFile怎麽用?C++ FindFile使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了FindFile函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: devLock

CmtFileBase*
CmtFat::FileCreate( cpchar fname, int32 msMode ) {
  FatDirEntry1x *ptr = 0;
  CmtFileBase *file = 0;
  devLock();
  if( msMode & CMT_CREATE_WRITE ) {
    //Открыть для записи
    ptr = FindFile( fname );
    //Если уже существует, то удалить файл
    if( ptr && (msMode & CMT_FILE_RESET) ) {
      DeleteFileEntry( ptr );
      ptr = 0;
      }
    //Создать новый файл
    if( ptr == 0 )
      ptr = CreateFileName( fname );
    }
  else if( msMode & CMT_CREATE_READ ) {
    //Открыть для чтения
    ptr = FindFile( fname );
    }
  if( ptr ) {
    //Файл найден
    file = new CmtFatFile( this, ptr, msMode );
    }
  devUnLock();
  return file;
  }
開發者ID:hogiboygoy,項目名稱:cmt-lib,代碼行數:28,代碼來源:cmtFat.cpp

示例2: FindFileSymbols

PTagArray FindFileSymbols(const char* file)
{
  String filename=file;
  filename.ToLower();
  PTagArray ta=new TagArray;
  for(int i=0;i<files.Count();i++)
  {
    if(files[i]->mainaload ||
       files[i]->isLoadBase(filename))
    {
      int j=0;
      while(filename[j]==files[i]->filename[j])j++;
      while(filename[j-1]!='\\')j--;
      if(files[i]->filename.Index("\\",j)==-1)
      {
        FindFile(files[i],filename.Substr(j),ta);
        FindFile(files[i],filename,ta);
      }
    }
  }
  if(ta->Count()==0)
  {
    delete ta;
    ta=NULL;
  }
  return ta;
}
開發者ID:Maximus5,項目名稱:evil-programmers,代碼行數:27,代碼來源:tags.cpp

示例3: RegisterInlineImage

	void Driver::RegisterInlineImage(const string& filename,const string& tag)
	{
            string f=FindFile(filename,"graphics");
            if(f=="")
            {
                cerr << "Warning: Image missing: "+filename << endl;
                f=FindFile("q.png","graphics");
            }
		inlineimage[tag]=LoadImage(f,Color(0,0,0));
	}
開發者ID:markferry,項目名稱:gccg-dev,代碼行數:10,代碼來源:driver.cpp

示例4: PathUtilsSuite_TestFindFile

void PathUtilsSuite_TestFindFile( PathUtilsSuiteData* data ) {
   char*       searchPaths = NULL;
   char        fullPath[1024];
   const char* subDir = "./testSubDir";
   const char* subDirFilename = "./testSubDir/subDirTest.xml";
   const char* currDirFilename = "./currDirTest.xml";


   Stg_asprintf( &searchPaths, ".:%s:/does/not/exist", subDir );
   /* Create necessary test files/dirs */
   if (data->rank==0) {
      FILE* subDirFile = NULL;
      FILE* currDirFile = NULL;

      currDirFile = fopen( currDirFilename, "w" );
      fputs( "test.\n", currDirFile );
      fclose( currDirFile );
      mkdir( subDir, 0755 );
      subDirFile = fopen( subDirFilename, "w" );
      fputs( "test.\n", subDirFile );
      fclose( subDirFile );
   }
   MPI_Barrier(MPI_COMM_WORLD);

   /* try and open some files using the search path */
   /* Only do this using proc 0 - for why, see warning in Doxygen comment for the function. */
   if (data->rank==0) {
      /* This first test is to make sure it can handle files preceded with ./ */
      FindFile( fullPath, currDirFilename, searchPaths );
      pcu_check_streq( fullPath, currDirFilename );

      FindFile( fullPath, "currDirTest.xml", searchPaths );
      pcu_check_streq( fullPath, currDirFilename );
      
      FindFile( fullPath, "subDirTest.xml", searchPaths );
      pcu_check_streq( fullPath, subDirFilename );
      
      FindFile( fullPath, "nofile.man", searchPaths );
      pcu_check_streq( fullPath, "" );
      
      FindFile( fullPath, "/Users/luke/Projects/StGermain/env_vars", searchPaths );
      pcu_check_streq( fullPath, "" );
   }

   if (data->rank==0) {
      remove( currDirFilename );
      remove( subDirFilename );
      rmdir( subDir );
   }
}
開發者ID:OlympusMonds,項目名稱:EarthByte_Underworld,代碼行數:50,代碼來源:PathUtilsSuite.c

示例5: PatientFindFile

bool PatientFindFile(const char* filePath, int numWaitTimes, int* waitTimes)
{
    if ( FindFile(filePath) )
        return true;

    for ( int i = 0; i < numWaitTimes; i++ )
    {
        Sleep(waitTimes[i]);
        if ( FindFile(filePath) )
            return true;
    }

    return false;
}
開發者ID:jjf28,項目名稱:Chkdraft,代碼行數:14,代碼來源:FileIO.cpp

示例6: Alloc_MaterialEffect

//----------------------------------------------------------------------------------------------
MaterialEffect* CFXMatManager::GetMaterialInstance(const char *Name)
{
	std::string sFilename;  

	if (!FindFile(Name, &sFilename)){
		return NULL;
	}

	MaterialEffect * pOutMatInstance = NULL;

	std::map<std::string, m_material>::iterator IterFind = m_MapMatPrototypes.find(sFilename.c_str());

	if (IterFind != m_MapMatPrototypes.end())
	{
		pOutMatInstance = Alloc_MaterialEffect(m_pRenderSDK->GetRenderDriver());
		
		std::string sFXFilename;

		if (FindFile(IterFind->second.fx_file.c_str(), &sFXFilename))
		{
			if (pOutMatInstance->Load(sFXFilename.c_str()))
			{
				pOutMatInstance->SetTechniqueName(IterFind->second.tehnique.c_str());
			}
		}
	}
	else
	{		
		m_material OutMaterial;

		if (Load(sFilename.c_str(), OutMaterial))
		{
			pOutMatInstance = Alloc_MaterialEffect(m_pRenderSDK->GetRenderDriver());

			std::string sFXFilename;

			if (FindFile(OutMaterial.fx_file.c_str(), &sFXFilename))
			{
				if (pOutMatInstance->Load(sFXFilename.c_str()))
				{
					pOutMatInstance->SetTechniqueName(OutMaterial.tehnique.c_str());
				}
			}

			m_MapMatPrototypes.insert(std::make_pair(sFilename, OutMaterial));
		}
	}
	
	return pOutMatInstance;
}
開發者ID:innovatelogic,項目名稱:ilogic-vm,代碼行數:51,代碼來源:FXMatManager.cpp

示例7: tmp

wxString Project::GetVDByFileName(const wxString& file)
{
    //find the file under this node
    // Convert the file path to be relative to
    // the project path
    DirSaver ds;

    ::wxSetWorkingDirectory(m_fileName.GetPath());
    wxFileName tmp(file);
    tmp.MakeRelativeTo(m_fileName.GetPath());

    wxString path(wxEmptyString);
    wxXmlNode *fileNode = FindFile(m_doc.GetRoot(), tmp.GetFullPath(wxPATH_UNIX));

    if (fileNode) {
        wxXmlNode *parent = fileNode->GetParent();
        while ( parent ) {
            if (parent->GetName() == wxT("VirtualDirectory")) {
                path.Prepend(parent->GetPropVal(wxT("Name"), wxEmptyString));
                path.Prepend(wxT(":"));
            } else {
                break;
            }
            parent = parent->GetParent();
        }
    }
    wxString trunc_path(path);
    path.StartsWith(wxT(":"), &trunc_path);
    return trunc_path;
}
開發者ID:Hmaal,項目名稱:codelite,代碼行數:30,代碼來源:project.cpp

示例8: EmitAsmIncludes

void EmitAsmIncludes()
/*
Purpose:
	Try to find corresponding .asm file for every used .atl file.
	If it is found, generate include instruction to output file.
*/
{
	Var * var;
	Instr i;
	FILE * f;
	char name[MAX_PATH_LEN], path[MAX_PATH_LEN];
	UInt16 len;

	MemEmptyVar(i);
	i.op = INSTR_INCLUDE;
	for(var = VarFirst(); var != NULL; var = VarNext(var)) {
		if (var->mode == INSTR_SRC_FILE) {
			if (FlagOff(var->submode, SUBMODE_MAIN_FILE)) {

				strcpy(name, var->name);
				len = StrLen(name);
				name[len-4] = 0;
				f = FindFile(name, ".asm", path);

				if (f != NULL) {
					fclose(f);
					i.arg1 = VarNewStr(FILENAME);
					EmitInstr(&i);
				}
			}
		}
	}
}
開發者ID:davidechiappetta,項目名稱:atalan,代碼行數:33,代碼來源:emit.c

示例9: FindFile

BOOL CSearcher::IsSomeThingInPath(const CString& dirPath, const CString& fullFileName)
{
	CString searchPathName;
    searchPathName.Format("%s\\%s", dirPath, "*.*");  // search all
	
	return FindFile(searchPathName);
}
開發者ID:dwatow,項目名稱:finder,代碼行數:7,代碼來源:Searcher.cpp

示例10: qDebug

void CGI_SCADA_DLL_HistoryMessageItem::slot_OpenProject(QString strProjectPath)
{
    qDebug()<<__func__<<__FILE__<<__LINE__;
    CGI_SCADA_DLL_TreeItemBase::slot_OpenProject(strProjectPath);
    m_DBFileList.clear();
    FindFile(strProjectPath);
}
開發者ID:Strongc,項目名稱:20160125CGI_Src,代碼行數:7,代碼來源:CGI_SCADA_DLL_HistoryMessageItem.cpp

示例11: FindFile

int HTMLProject::FindLabel(const HTMLLabel *label)
{
	HTMLFile *file = label->GetFile();
	int fn = FindFile(file);
	delete file;
	
	if (fn<0)
		return -1;
	
	unsigned int n = labelList->CountItems();
	if (n==0)
		return -1;
		
	for (unsigned int i=0; i<n; i++)
	{
		smallLabel *lab = (smallLabel*)labelList->ItemAt(i);
		if (lab->file == (unsigned int)fn)
		{
			if (lab->label == label->lname)
				return i;
		}
		else
			if (lab->file > (unsigned int)fn)
				return -1;	
	}
	
	return -1;
}
開發者ID:mmadia,項目名稱:behappy-svn_clone,代碼行數:28,代碼來源:HTMLProject.cpp

示例12: FindFile

const IStream* FileStorage::ReadFile(const StringRef& path, DirectoryEntry* parent /*= nullptr*/, FileDataType dataType /*= FileDataType::Binary*/)const
{
	const FileEntry* fileEntry = FindFile(path, parent);
	RETURN_NULL_IF_NULL(fileEntry);

	return ReadFileHelper(*fileEntry, dataType);
}
開發者ID:johndpope,項目名稱:Medusa,代碼行數:7,代碼來源:FileStorage.cpp

示例13: Release

// 從文件讀取原始列表
BOOL CSkillList::LoadSkillList(const char* stepfilename, const char* dir_name)
{
	Release();

	// 讀取技能名稱對應的CommandID
	char *index="SkillStep";
	CIni Ini("data/SkillStep.ini");
	int num=Ini.GetContinueDataNum(index);

	for(int i=0; i<num; i++)
	{
		int nCommandID;
		char *tmp=Ini.ReadCaption(index, i);
		nCommandID=atoi(tmp);		//獲得指令Id
		SAFE_DELETE(tmp);
		tmp=Ini.ReadText(index, i);
		m_mapStepNameID[tmp]=nCommandID;
		SAFE_DELETE(tmp);
	}	

	// 讀取目錄中的所有技能文件
	list<string> listFileName;
	FindFile(dir_name, ".skill", &listFileName);

	for(list<string>::iterator it=listFileName.begin(); it!=listFileName.end(); it++)
	{
		const char* filename = it->c_str();
		LoadOneSkill(filename);
	}

	return true;
}
開發者ID:ueverything,項目名稱:mmo-resourse,代碼行數:33,代碼來源:SkillList.cpp

示例14: spec

void CStateDownload::ScanDirectory(RFs& aFs, const TDesC& aDir, const TDesC& aWild, CDesCArray* aFilesArray)
	{
	TParse parse;
	parse.Set(aWild, &aDir, NULL);
	TPtrC spec(parse.FullName());
	 
	TFindFile FindFile(aFs);
	CDir* dir;
	 
	if (FindFile.FindWildByPath(parse.FullName(), NULL, dir) == KErrNone)
		{
	    CleanupStack::PushL(dir);
	 
	    TInt count=dir->Count();
	    for(TInt i = 0; i < count; i++)
	    	{
	        parse.Set((*dir)[i].iName, &spec, NULL);
	        TEntry entry;
	        if(aFs.Entry(parse.FullName(),entry) == KErrNone)
	        	{
	        	if(!entry.IsDir())
	        		{
	        		//InsertIsqL raises a KErrAlreadyExists (-11) when inserting a duplicate
	        		TRAPD(err,aFilesArray->InsertIsqL(parse.FullName())); 
	        		}
	        	}
	        }
	    CleanupStack::PopAndDestroy(dir);
	    }
	}
開發者ID:BwRy,項目名稱:core-symbian,代碼行數:30,代碼來源:StateDownload.cpp

示例15: LOG

// Returns a string list of details about the file
// in the order EXISTS, DATE, SIZE
QStringList StorageGroup::GetFileInfo(QString filename)
{
    LOG(VB_FILE, LOG_DEBUG, LOC + 
        QString("GetFileInfo: For '%1'") .arg(filename));

    QStringList details;
    bool searched = false;

    if (!FileExists(filename))
    {
        searched = true;
        filename = FindFile(filename);
    }

    if ((searched && !filename.isEmpty()) ||
        (FileExists(filename)))
    {
        QFileInfo fInfo(filename);

        details << filename;
        details << QString("%1").arg(fInfo.lastModified().toTime_t());
        details << QString("%1").arg(fInfo.size());
    }

    return details;
}
開發者ID:gdenning,項目名稱:mythtv,代碼行數:28,代碼來源:storagegroup.cpp


注:本文中的FindFile函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。