这篇教程C++ File_Exists函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中File_Exists函数的典型用法代码示例。如果您正苦于以下问题:C++ File_Exists函数的具体用法?C++ File_Exists怎么用?C++ File_Exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了File_Exists函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: VDI_FixDesktopInf/** * Modify (or create) ST desktop configuration files so VDI boots up in * correct color depth */static void VDI_FixDesktopInf(void){ char *szDesktopFileName, *szNewDeskFileName; if (!GEMDOS_EMU_ON) { /* Can't modify DESKTOP.INF when not using GEMDOS hard disk emulation */ return; } szDesktopFileName = malloc(2 * FILENAME_MAX); if (!szDesktopFileName) { perror("VDI_FixDesktopInf"); return; } szNewDeskFileName = szDesktopFileName + FILENAME_MAX; /* Create filenames for hard-drive */ GemDOS_CreateHardDriveFileName(2, "//DESKTOP.INF", szDesktopFileName, FILENAME_MAX); GemDOS_CreateHardDriveFileName(2, "//NEWDESK.INF", szNewDeskFileName, FILENAME_MAX); /* First, check if files exist(ie modify or replace) */ if (!File_Exists(szDesktopFileName)) VDI_SaveDesktopInf(szDesktopFileName,DesktopScript,sizeof(DesktopScript)); VDI_ModifyDesktopInf(szDesktopFileName); if (!File_Exists(szNewDeskFileName)) VDI_SaveDesktopInf(szNewDeskFileName,NewDeskScript,sizeof(NewDeskScript)); VDI_ModifyDesktopInf(szNewDeskFileName); free(szDesktopFileName);}
开发者ID:jonathanopalise,项目名称:hatari,代码行数:37,
示例2: VDI_FixDesktopInf/** * Modify (or create) ST desktop configuration files so VDI boots up in * correct color depth */static void VDI_FixDesktopInf(void){ char *szDesktopFileName, *szNewDeskFileName; /* Modifying DESKTOP.INF only makes sense when we emulate the GEMDOS * hard disk 'C:' (i.e. the HD we boot from) - if not, simply return */ if (!GemDOS_IsDriveEmulated(2)) { return; } szDesktopFileName = malloc(2 * FILENAME_MAX); if (!szDesktopFileName) { perror("VDI_FixDesktopInf"); return; } szNewDeskFileName = szDesktopFileName + FILENAME_MAX; /* Create filenames for hard-drive */ GemDOS_CreateHardDriveFileName(2, "//DESKTOP.INF", szDesktopFileName, FILENAME_MAX); GemDOS_CreateHardDriveFileName(2, "//NEWDESK.INF", szNewDeskFileName, FILENAME_MAX); /* First, check if files exist(ie modify or replace) */ if (!File_Exists(szDesktopFileName)) VDI_SaveDesktopInf(szDesktopFileName,DesktopScript,sizeof(DesktopScript)); VDI_ModifyDesktopInf(szDesktopFileName); if (!File_Exists(szNewDeskFileName)) VDI_SaveDesktopInf(szNewDeskFileName,NewDeskScript,sizeof(NewDeskScript)); VDI_ModifyDesktopInf(szNewDeskFileName); free(szDesktopFileName);}
开发者ID:libretro,项目名称:hatari,代码行数:38,
示例3: Loadbool cPreferences :: Load( const std::string &filename /* = "" */ ){ Reset_All(); // if config file is given if( filename.length() ) { m_config_filename = filename; } // prefer local config file if( File_Exists( m_config_filename ) ) { printf( "Using local preferences file : %s/n", m_config_filename.c_str() ); } // user dir else { m_config_filename.insert( 0, pResource_Manager->user_data_dir ); /* fixme : this crashes in CEGUI::DefaultResourceProvider::loadRawDataContainer because of the é * The CEGUI string encoding is UTF-8 but std::string seems to be ISO-8859-1 or Code page 1252 */ //config_filename.insert( 0, "N:/Dokumente und Einstellungen/smc_Invité/Anwendungsdaten/smc/" ); // does not exist in user dir if( !File_Exists( m_config_filename ) ) { // only print warning if file is given if( !filename.empty() ) { printf( "Couldn't open preferences file : %s/n", m_config_filename.c_str() ); } return 0; } } try { //CEGUI::String str = "N:/Dokumente und Einstellungen/smc_Invité/Anwendungsdaten/smc/config.xml"; CEGUI::System::getSingleton().getXMLParser()->parseXMLFile( *this, m_config_filename, DATA_DIR "/" GAME_SCHEMA_DIR "/Config.xsd", "" ); } // catch CEGUI Exceptions catch( CEGUI::Exception &ex ) { printf( "Preferences Loading CEGUI Exception %s/n", ex.getMessage().c_str() ); pHud_Debug->Set_Text( _("Preferences Loading failed : ") + (const std::string)ex.getMessage().c_str() ); } // if user data dir is set if( !m_force_user_data_dir.empty() ) { pResource_Manager->Set_User_Directory( m_force_user_data_dir ); } return 1;}
开发者ID:as02700,项目名称:Eta-Chronicles,代码行数:56,
示例4: Loadbool cOverworld :: Load( void ){ Unload(); // description m_description->Load(); // world std::string world_filename = m_description->Get_Full_Path() + "/world.xml"; if( !File_Exists( world_filename ) ) { printf( "Couldn't find World file : %s from %s/n", world_filename.c_str(), m_description->m_path.c_str() ); return 0; } try { // parse overworld // fixme : Workaround for std::string to CEGUI::String utf8 conversion. Check again if CEGUI 0.8 works with std::string utf8 #ifdef _WIN32 CEGUI::System::getSingleton().getXMLParser()->parseXMLFile( *this, (const CEGUI::utf8*)world_filename.c_str(), DATA_DIR "/" GAME_SCHEMA_DIR "/World/World.xsd", "" ); #else CEGUI::System::getSingleton().getXMLParser()->parseXMLFile( *this, world_filename.c_str(), DATA_DIR "/" GAME_SCHEMA_DIR "/World/World.xsd", "" ); #endif } // catch CEGUI Exceptions catch( CEGUI::Exception &ex ) { printf( "Loading World %s CEGUI Exception %s/n", world_filename.c_str(), ex.getMessage().c_str() ); pHud_Debug->Set_Text( _("World Loading failed : ") + (const std::string)ex.getMessage().c_str() ); } // engine version entry not set if( m_engine_version < 0 ) { m_engine_version = 0; } // layer std::string layer_filename = m_description->Get_Full_Path() + "/layer.xml"; if( !File_Exists( layer_filename ) ) { printf( "Couldn't find World Layer file : %s from %s/n", layer_filename.c_str(), m_description->m_path.c_str() ); return 0; } m_layer->Load( layer_filename ); // set name m_hud_world_name->Set_Image( pFont->Render_Text( pFont->m_font_normal, m_description->m_name, yellow ), 1, 1 ); return 1;}
开发者ID:120pulsations,项目名称:SMC,代码行数:55,
示例5: ReadTileTypeFilebool CTileset::ReadTileTypeFile(char * szFile){ //Detect if the tiletype file already exists, if not create it if(File_Exists(szFile)) { FILE * tsf = fopen(szFile, "rb"); if(tsf == NULL) { printf("ERROR: couldn't open tileset file: %s/n", szFile); return false; } iTileTypeSize = ReadInt(tsf); if(iTileTypeSize <= 0 || iTileTypeSize > 1024) { fclose(tsf); return false; } tiletypes = new TileType[iTileTypeSize]; for(short i = 0; i < iTileTypeSize; i++) { tiletypes[i] = (TileType)ReadInt(tsf); } fclose(tsf); } else { iTileTypeSize = iWidth * iHeight; tiletypes = new TileType[iTileTypeSize]; for(short i = 0; i < iTileTypeSize; i++) { tiletypes[i] = tile_nonsolid; } } return true;}
开发者ID:BlazingSun,项目名称:super-mario-war,代码行数:35,
示例6: DebugUI_MemorySnapShot_Capture/** * Save/Restore snapshot of debugging session variables */void DebugUI_MemorySnapShot_Capture(const char *path, bool bSave){ char *filename; filename = malloc(strlen(path) + strlen(".debug") + 1); assert(filename); strcpy(filename, path); strcat(filename, ".debug"); if (bSave) { /* save breakpoints as debugger input file */ BreakCond_Save(filename); } else { /* remove current CPU and DSP breakpoints */ BreakCond_Command("all", false); BreakCond_Command("all", true); if (File_Exists(filename)) { /* and parse back the saved breakpoints */ DebugUI_ParseFile(filename, true); } } free(filename);}
开发者ID:diablodiab,项目名称:hatari,代码行数:31,
示例7: ReadTileTypeFilebool CTileset::ReadTileTypeFile(char * szFile){ //Detect if the tiletype file already exists, if not create it if (File_Exists(szFile)) { BinaryFile tsf(szFile, "rb"); if (!tsf.is_open()) { printf("ERROR: couldn't open tileset file: %s/n", szFile); return false; } iTileTypeSize = tsf.read_i32(); if (iTileTypeSize <= 0 || iTileTypeSize > 1024) { return false; } tiletypes = new TileType[iTileTypeSize]; for (short i = 0; i < iTileTypeSize; i++) { tiletypes[i] = (TileType)tsf.read_i32(); } } else { iTileTypeSize = iWidth * iHeight; tiletypes = new TileType[iTileTypeSize]; for (short i = 0; i < iTileTypeSize; i++) { tiletypes[i] = tile_nonsolid; } } return true;}
开发者ID:carstene1ns,项目名称:supermariowar,代码行数:32,
示例8: Get_Directory_Filesvoid cOverworld_Manager::Load_Dir(const fs::path& dir, bool user_dir /* = false */){ // set world directory vector<fs::path> subdirs = Get_Directory_Files(dir, "", true, false); std::sort(subdirs.begin(), subdirs.end()); for (vector<fs::path>::iterator curdir = subdirs.begin(); curdir != subdirs.end(); ++curdir) { try { fs::path current_dir = *curdir; // only directories with an existing description if (File_Exists(current_dir / "description.xml")) { cOverworld* overworld = Get_from_Path(current_dir); // already available if (overworld) { overworld->m_description->m_user = 2; // 2 = available in system *and* in user dir continue; } overworld = cOverworld::Load_From_Directory(current_dir, user_dir); objects.push_back(overworld); } } catch (const std::exception& ex) { printf("%s %s/n", path_to_utf8(*curdir).c_str(), ex.what()); } }}
开发者ID:Clever-Boy,项目名称:TSC,代码行数:29,
示例9: FillSavegameDescstatic void FillSavegameDesc(bool save){ uint8 i; for (i = 0; i < 5; i++) { char *desc = g_savegameDesc[i]; char *filename; uint8 fileId; *desc = '/0'; if (s_savegameIndexBase - i < 0) continue; if (s_savegameIndexBase - i == s_savegameCountOnDisk) { if (!save) continue; strncpy(desc, String_Get_ByIndex(STR_EMPTY_SLOT_), 50); continue; } filename = GenerateSavegameFilename(s_savegameIndexBase - i); if (!File_Exists(filename)) continue; fileId = ChunkFile_Open(filename); ChunkFile_Read(fileId, HTOBE32(CC_NAME), desc, 50); ChunkFile_Close(fileId); continue; }}
开发者ID:Haozerk,项目名称:OpenDUNE,代码行数:30,
示例10: Set_Image_Dirvoid cFlyon::Set_Image_Dir(fs::path dir){ if (dir.empty()) { return; } // if not image directory if (!File_Exists(pResource_Manager->Get_Game_Pixmaps_Directory() / dir / utf8_to_path("closed_1.settings")) && !File_Exists(pResource_Manager->Get_Game_Pixmaps_Directory() / dir / utf8_to_path("closed_1.png"))) { std::cerr << "Warning: Flyon image files not found; does the flyon directory " << path_to_utf8(dir) << " exist?" << std::endl; return; } m_img_dir = dir; // clear images Clear_Images(); // set images Add_Image(pVideo->Get_Surface(m_img_dir / utf8_to_path("closed_1.png"))); Add_Image(pVideo->Get_Surface(m_img_dir / utf8_to_path("closed_2.png"))); Add_Image(pVideo->Get_Surface(m_img_dir / utf8_to_path("open_1.png"))); Add_Image(pVideo->Get_Surface(m_img_dir / utf8_to_path("open_2.png"))); // set start image Set_Image_Num(0, 1); Set_Animation(1); Set_Animation_Image_Range(0, 3); Set_Time_All(130, 1); Reset_Animation();}
开发者ID:Clever-Boy,项目名称:TSC,代码行数:30,
示例11: Configuration_Load/** * Load program setting from configuration file. If psFileName is NULL, use * the configuration file given in configuration / last selected by user. */void Configuration_Load(const char *psFileName){ if (psFileName == NULL) psFileName = sConfigFileName; if (!File_Exists(psFileName)) { Log_Printf(LOG_DEBUG, "Configuration file %s not found./n", psFileName); return; } Configuration_LoadSection(psFileName, configs_Log, "[Log]"); Configuration_LoadSection(psFileName, configs_ConfigDialog, "[ConfigDialog]"); Configuration_LoadSection(psFileName, configs_Debugger, "[Debugger]"); Configuration_LoadSection(psFileName, configs_Screen, "[Screen]"); Configuration_LoadSection(psFileName, configs_Keyboard, "[Keyboard]"); Configuration_LoadSection(psFileName, configs_ShortCutWithMod, "[ShortcutsWithModifiers]"); Configuration_LoadSection(psFileName, configs_ShortCutWithoutMod, "[ShortcutsWithoutModifiers]"); Configuration_LoadSection(psFileName, configs_Mouse, "[Mouse]"); Configuration_LoadSection(psFileName, configs_Sound, "[Sound]"); Configuration_LoadSection(psFileName, configs_Memory, "[Memory]"); Configuration_LoadSection(psFileName, configs_Boot, "[Boot]"); Configuration_LoadSection(psFileName, configs_SCSI, "[HardDisk]"); Configuration_LoadSection(psFileName, configs_MO, "[MagnetoOptical]"); Configuration_LoadSection(psFileName, configs_Floppy, "[Floppy]"); Configuration_LoadSection(psFileName, configs_Ethernet, "[Ethernet]"); Configuration_LoadSection(psFileName, configs_Rom, "[ROM]"); Configuration_LoadSection(psFileName, configs_Printer, "[Printer]"); Configuration_LoadSection(psFileName, configs_System, "[System]"); Configuration_LoadSection(psFileName, configs_Dimension, "[Dimension]");}
开发者ID:itomato,项目名称:Previous,代码行数:35,
示例12: Opt_StrCpy/** * If 'checkexits' is true, assume 'src' is a file and check whether it * exists before copying 'src' to 'dst'. Otherwise just copy option src * string to dst. * If a pointer to (bool) 'option' is given, set that option to true. * - However, if src is "none", leave dst unmodified & set option to false. * ("none" is used to disable options related to file arguments) * Return false if there were errors, otherwise true */static bool Opt_StrCpy(int optid, bool checkexist, char *dst, const char *src, size_t dstlen, bool *option){ if (option) { *option = false; if(strcasecmp(src, "none") == 0) { return true; } } if (strlen(src) >= dstlen) { return Opt_ShowError(optid, src, "File name too long!"); } if (checkexist && !File_Exists(src)) { return Opt_ShowError(optid, src, "Given file doesn't exist (or has wrong file permissions)!"); } if (option) { *option = true; } strcpy(dst, src); return true;}
开发者ID:lordashram,项目名称:hatari-libretro,代码行数:34,
示例13: DlgDisk_BrowseDisk/** * Let user browse given disk, insert disk if one selected. */static void DlgDisk_BrowseDisk(char *dlgname, int drive, int diskid){ char *selname, *zip_path; const char *tmpname, *realname; assert(drive >= 0 && drive < MAX_FLOPPYDRIVES); if (szDiskFileName[drive][0]) tmpname = szDiskFileName[drive]; else tmpname = szDiskImageDirectory; selname = SDLGui_FileSelect(tmpname, &zip_path, false); if (!selname) return; printf("in)d%d:(%s)/n",drive,selname); if (File_Exists(selname)) {printf("----------Exist)/n"); realname = Floppy_SetDiskFileName(drive, selname, zip_path); if (realname) File_ShrinkName(dlgname, realname, floppydlg[diskid].w); } else {printf("---------not found/n"); Floppy_SetDiskFileNameNone(drive); dlgname[0] = '/0'; } if (zip_path) free(zip_path); free(selname);}
开发者ID:r-type,项目名称:uae4arm-libretro,代码行数:33,
示例14: Floppy_SetDiskFileName/** * Set given floppy drive image file name and handle * different image extensions. * Return corrected file name on success and NULL on failure. */const char* Floppy_SetDiskFileName(int Drive, const char *pszFileName, const char *pszZipPath){ char *filename; int i; /* setting to empty or "none" ejects */ if (!*pszFileName || strcasecmp(pszFileName, "none") == 0) { return Floppy_SetDiskFileNameNone(Drive); } /* See if file exists, and if not, get/add correct extension */ if (!File_Exists(pszFileName)) filename = File_FindPossibleExtFileName(pszFileName, pszDiskImageNameExts); else filename = strdup(pszFileName); if (!filename) { Log_AlertDlg((const char *)LOG_INFO, "Image '%s' not found", pszFileName); return NULL; }#if 0 /* If we insert a disk into Drive A, should we try to put disk 2 into drive B? */ if (Drive == 0 && ConfigureParams.DiskImage.bAutoInsertDiskB) { /* Attempt to make up second filename, eg was 'auto_100a' to 'auto_100b' */ char *szDiskBFileName = Floppy_CreateDiskBFileName(filename); if (szDiskBFileName) { /* recurse with Drive B */ Floppy_SetDiskFileName(1, szDiskBFileName, pszZipPath); free(szDiskBFileName); } }#endif /* validity checks */ assert(Drive >= 0 && Drive < MAX_FLOPPYDRIVES); for (i = 0; i < MAX_FLOPPYDRIVES; i++) { if (i == Drive) continue; /* prevent inserting same image to multiple drives */ if (strcmp(filename, /*ConfigureParams.DiskImage.*/szDiskFileName[i]) == 0) { Log_AlertDlg((const char *)LOG_ERROR, "ERROR: Cannot insert same floppy to multiple drives!"); return NULL; } } /* do the changes */ if (pszZipPath) strcpy(szDiskZipPath[Drive], pszZipPath); else szDiskZipPath[Drive][0] = '/0'; strcpy(szDiskFileName[Drive], filename); free(filename); //File_MakeAbsoluteName(ConfigureParams.DiskImage.szDiskFileName[Drive]); return szDiskFileName[Drive];}
开发者ID:r-type,项目名称:uae4arm-libretro,代码行数:64,
示例15: GetSavegameCountstatic uint16 GetSavegameCount(void){ uint16 i; for (i = 0;; i++) { if (!File_Exists(GenerateSavegameFilename(i))) return i; }}
开发者ID:Haozerk,项目名称:OpenDUNE,代码行数:8,
示例16: File_Exists_And_Is_A_Socketbool File_Exists_And_Is_A_Socket(std::string path_to_file){ if (File_Exists(path_to_file)){ if (Is_A_Socket(path_to_file)){ return true; } } return false;}
开发者ID:UniLang,项目名称:control-structure-printer,代码行数:8,
示例17: File_Exists_And_Is_Regular_Filebool File_Exists_And_Is_Regular_File(std::string path_to_file){ if (File_Exists(path_to_file)){ if (Is_Regular_File(path_to_file)){ return true; } } return false;}
开发者ID:UniLang,项目名称:control-structure-printer,代码行数:8,
示例18: File_Exists_And_Is_Directorybool File_Exists_And_Is_Directory(std::string path_to_file){ if (File_Exists(path_to_file)){ if (Is_Directory(path_to_file)){ return true; } } return false;}
开发者ID:UniLang,项目名称:control-structure-printer,代码行数:8,
示例19: File_Exists_And_Is_Symbolic_Linkbool File_Exists_And_Is_Symbolic_Link(std::string path_to_file){ if (File_Exists(path_to_file)){ if (Is_Symbolic_Link(path_to_file)){ return true; } } return false;}
开发者ID:UniLang,项目名称:control-structure-printer,代码行数:8,
示例20: Create_Path_If_It_Doesnt_Already_Exist//+--------------+//| Transformers |//+--------------+ void Create_Path_If_It_Doesnt_Already_Exist(std::string const& path){ if (!File_Exists(path)){ execute_quietly(("mkdir -p " + path).c_str()); } return; }
开发者ID:Jstd,项目名称:Jstd-Bootstrap,代码行数:11,
示例21: File_Exists_And_Is_A_Block_Special_Filebool File_Exists_And_Is_A_Block_Special_File(std::string path_to_file){ if (File_Exists(path_to_file)){ if (Is_A_Block_Special_File(path_to_file)){ return true; } } return false;}
开发者ID:UniLang,项目名称:control-structure-printer,代码行数:8,
示例22: GameOptions_Load/** * Loads the game options. * * @return True if loading is successful. */bool GameOptions_Load(void){ if (!File_Exists("OPTIONS.CFG")) return false; File_ReadBlockFile("OPTIONS.CFG", &g_gameConfig, sizeof(g_gameConfig)); return true;}
开发者ID:fourks,项目名称:OpenDUNE,代码行数:13,
示例23: RecordRoutingInfostatic BoolRecordRoutingInfo(NicInfoV3 *nicInfo){ Bool retIPv4 = TRUE; Bool retIPv6 = TRUE; if (File_Exists("/proc/net/route") && !RecordRoutingInfoIPv4(nicInfo)) { g_warning("%s: Unable to collect IPv4 routing table./n", __func__); retIPv4 = FALSE; } if (File_Exists("/proc/net/ipv6_route") && !RecordRoutingInfoIPv6(nicInfo)) { g_warning("%s: Unable to collect IPv6 routing table./n", __func__); retIPv6 = FALSE; } return (retIPv4 || retIPv6);}
开发者ID:tmeralli-tehtris,项目名称:open-vm-tools-security-research,代码行数:18,
示例24: Make_Sure_The_Necessary_Files_Are_Present_At_Subfolderbool Subfolder_Scanner::Make_Sure_The_Necessary_Files_Are_Present_At_Subfolder(Warn_Machine & warn_machine){ for (auto const& file: constant::NEEDED_FILES_FOR_EACH_PSEUDO_SUB_DIRECTORY){ if (!File_Exists(file)){ if (!warn_machine.Record_Missing_File(file)) { return false;} } } return true; }
开发者ID:Jstd,项目名称:Jstd,代码行数:10,
示例25: DebugUI_SetParseFile/** * Set debugger commands file during Hatari startup before things * needed by the debugger are initialized so that it can be parsed * when debugger itself gets initialized. * Return true if file exists, false otherwise. */bool DebugUI_SetParseFile(const char *path){ if (File_Exists(path)) { parseFileName = path; return true; } fprintf(stderr, "ERROR: debugger input file '%s' missing./n", path); return false;}
开发者ID:diablodiab,项目名称:hatari,代码行数:16,
示例26: Driver_Voice_LoadFilevoid Driver_Voice_LoadFile(const char *filename, void *buffer, uint32 length){ assert(buffer != NULL); if (filename == NULL) return; if (g_driverVoice->index == 0xFFFF) return; if (!File_Exists(filename)) return; File_ReadBlockFile(filename, buffer, length);}
开发者ID:ArchmageRaist,项目名称:OpenDUNE,代码行数:10,
示例27: sprintfvoid ENVIRONMENT::SavedFile_FindNext(void) { savedFileIndex++; char fileName[100]; sprintf(fileName,"SavedFiles/env%d.dat",savedFileIndex); if ( !File_Exists(fileName) ) savedFileIndex = 0;}
开发者ID:jbongard,项目名称:ISCS,代码行数:11,
注:本文中的File_Exists函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ Fill函数代码示例 C++ File_Close函数代码示例 |