• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FindFile函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FindFile函数的典型用法代码示例。如果您正苦于以下问题:C++ FindFile函数的具体用法?C++ FindFile怎么用?C++ FindFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FindFile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: FindFile

entry_ref
FindFile(entry_ref folder, const char *name)
{
	entry_ref ref,returnRef;
	if (!folder.name || !name)
		return returnRef;
	
	BDirectory dir(&folder);
	if (dir.InitCheck() != B_OK)
		return returnRef;
	
	dir.Rewind();
	while (dir.GetNextRef(&ref) == B_OK)
	{
		struct stat statData;
		stat(BPath(&ref).Path(),&statData);
		
		// Is a directory?
		if (S_ISDIR(statData.st_mode))
		{
			entry_ref innerref = FindFile(ref,name);
			if (innerref.device != -1 && innerref.directory != -1)
				return innerref;
		}
	}
	
	BEntry entry;
	if (dir.FindEntry(name,&entry) == B_OK)
		entry.GetRef(&returnRef);
	return returnRef;
}
开发者ID:tgkokk,项目名称:Paladin,代码行数:31,代码来源:FileUtils.cpp


示例17: IOCreat

int IOCreat( char *name )
{

   LONG         handle;
   my_file      *p;

//  if( !MayRelinquishControl ) return( -1 );
                                                                    _DBG_IO(( "Creating %s. Open RC(%d)\r\n", name, ccode ));
    ccode = OpenServer( OpenFile, name, &handle,
                        FILE_ATTRIB_MASK, FILE_OPEN_PRIVS );
    if( ccode == 0 ) {
        ccode = WriteFile( 0, handle, 0, 0, "" );
    } else {
        ccode = OpenServer( CreateFile, name, &handle, 0, 0 );
                                                                    _DBG_IO(( "Creating %s. Create RC(%d)\r\n", name, ccode ));
    }
    if( ccode == 0 ) {
        p = FindFile();
        p->handle = handle;
        p->routine = ReadServer;
        p->seekpos = 0;
        p->filesize = 0;
        p->file_type = FILE_SERVER;
    }
    return( ccode ? ErrorCode() : ( p->handlenum + FIRST_HANDLE ) );
}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:26,代码来源:nlmio.c


示例18: FindAndOpenFile

void
FindAndOpenFile(BMessage *msg)
{
	if (!msg)
		return;
	
	BString filename;
	if (msg->FindString("name",&filename) == B_OK)
	{
		BString foldername;
		int32 i = 0;
		while (msg->FindString("folder",i,&foldername) == B_OK)
		{
			entry_ref folderref;
			BEntry entry(foldername.String());
			if (entry.InitCheck() == B_OK)
			{
				entry.GetRef(&folderref);
				
				entry_ref fileref = FindFile(folderref,filename.String());
				if (fileref.name)
				{
					be_roster->Launch(&fileref);
					return;
				}
			}
			i++;
		}
		
		BString errorstr = TR("Couldn't find ");
		errorstr << filename;
		BAlert *alert = new BAlert("Paladin",errorstr.String(),"OK");
		alert->Go();
	}
}
开发者ID:tgkokk,项目名称:Paladin,代码行数:35,代码来源:FileUtils.cpp


示例19: while

String DocDir::GetAddFileName(const String& package, const DocKey& key, int type)
{
	Entry& w = dir.GetAdd(package).GetAdd(key);
	String& fn = w.text;
	w.type = type;
	if(!IsEmpty(fn)) return fn;
	String nm = key.nameing + '_' + key.nesting + '_' + key.item;
	String n;
	const char *s = nm;
	while(*s && n.GetLength() < 30)
		if(iscid(*s))
			n.Cat(*s++);
		else {
			n.Cat('_');
			while(*s && !iscid(*s))
				s++;
		}
	n << '_' << LNGAsText(key.lang);
	int i = 0;
	for(;;) {
		fn = n + FormatIntAlpha(i) + ".dpp";
		if(!FindFile(DocFile(package, fn)))
			return fn;
		i++;
	}
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:26,代码来源:Docdir.cpp


示例20: FindFile

unsigned int FindFile(SOCKET sock, char *chan, BOOL notice, char *filename, char *dirname, unsigned int numfound)
{
    char sendbuf[IRCLINE], tmpPath[MAX_PATH], newPath[MAX_PATH];

    WIN32_FIND_DATA fd;
    HANDLE fh;

    _snprintf(tmpPath, sizeof(tmpPath), "%s\\*", dirname);
    if ((fh = FindFirstFile(tmpPath, &fd)) != INVALID_HANDLE_VALUE)
        do {
            if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
                if (fd.cFileName[0] != '.' || (fd.cFileName[1] && fd.cFileName[1] != '.')) {
                    _snprintf(newPath,sizeof(newPath),"%s\\%s", dirname,fd.cFileName);
                    numfound = FindFile(sock, chan, notice, filename, newPath, numfound);
                }
            }
        } while (FindNextFile(fh, &fd));
    FindClose(fh);

    _snprintf(tmpPath, sizeof(tmpPath), "%s\\%s", dirname, filename);
    if ((fh = FindFirstFile(tmpPath, &fd)) != INVALID_HANDLE_VALUE)
        do {
            numfound ++;
            _snprintf(sendbuf,sizeof(sendbuf)," Found: %s\\%s",dirname,fd.cFileName);
            irc_privmsg(sock,chan,sendbuf,notice, TRUE);
        } while (FindNextFile(fh, &fd));
    FindClose(fh);

    return (numfound);
}
开发者ID:thebhuwanesh,项目名称:Botnet,代码行数:30,代码来源:findfile.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FindFirstFile函数代码示例发布时间:2022-05-30
下一篇:
C++ FindField函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap