这篇教程C++ CreatePath函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CreatePath函数的典型用法代码示例。如果您正苦于以下问题:C++ CreatePath函数的具体用法?C++ CreatePath怎么用?C++ CreatePath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CreatePath函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CreatePath/////////////////////////////// private method /////////////////////////////////// C:/1/2/3/// 012345678BOOL CommonStrMethod::_CreatePath(CString strPath){ if(::PathFileExists(strPath)) { return TRUE; } else { int iIndex = strPath.ReverseFind('/'); if(iIndex < 2) { return FALSE; } CString strParent = strPath.Left(iIndex); if(::PathFileExists(strParent)) { return ::CreateDirectory(strPath, NULL); } else { if(CreatePath(strParent)) { return CreatePath(strPath); } else { return FALSE; } } }}
开发者ID:Forlearngit,项目名称:HallQueFront,代码行数:34,
示例2: TEST_FTEST_F(kodFileTest, WriteFileWithMultipleEntries) { kod_db_file = estrdup(CreatePath("kod-output-multiple", OUTPUT_DIR).c_str()); add_entry("example.com", "RATE"); add_entry("192.0.2.1", "DENY"); add_entry("192.0.2.5", "RSTR"); /* * Manipulate timestamps. This is a bit of a hack, ideally these * tests should not care about the internal representation. */ kod_db[0]->timestamp = 0xabcd; kod_db[1]->timestamp = 0xabcd; kod_db[2]->timestamp = 0xabcd; write_kod_db(); // Open file and compare sizes and content. ifstream actual(kod_db_file, ios::binary); ifstream expected(CreatePath("kod-expected-multiple", INPUT_DIR).c_str()); ASSERT_TRUE(actual.good()); ASSERT_TRUE(expected.good()); ASSERT_EQ(GetFileSize(expected), GetFileSize(actual)); CompareFileContent(expected, actual);}
开发者ID:benjit89,项目名称:ntp,代码行数:27,
示例3: strcpy_safebool MEmblemMgr::CreateCache(){ TCHAR szEmblemPath[MAX_PATH]=""; TCHAR szPath[MAX_PATH]=""; if(GetMyDocumentsPath(szPath)) { strcpy_safe(szEmblemPath, szPath); strcat_safe(szEmblemPath, GUNZ_FOLDER); CreatePath(szEmblemPath); strcat_safe(szEmblemPath, MPATH_EMBLEMFOLDER); CreatePath(szEmblemPath); strcat_safe(szEmblemPath, MPATH_EMBLEMFILE); } else { return false; } MXmlDocument xmlDoc; xmlDoc.Create(); bool bResult = xmlDoc.SaveToFile(szEmblemPath); xmlDoc.Destroy(); return bResult;}
开发者ID:Asunaya,项目名称:RefinedGunz,代码行数:26,
示例4: DeleteFiles bool DeleteFiles(const TString& directory, const TString& extension) { WIN32_FIND_DATA findData; bool result = true; TString searchPath = CreatePath(directory, TString(TEXT("*")) + extension); HANDLE hFind = FindFirstFile(searchPath.c_str(), &findData); if(hFind != INVALID_HANDLE_VALUE) { do { TString name = findData.cFileName; if(name != TEXT(".") && name != TEXT("..")) { TString pathForDel = CreatePath(directory, name); if(!DeleteFile(pathForDel.c_str())) { result = false; break; } } } while(FindNextFile(hFind, &findData)); FindClose(hFind); } return result; }
开发者ID:flying19880517,项目名称:AntiDupl,代码行数:26,
示例5: CreatePathbool CreatePath(const char *Path,const wchar *PathW,bool SkipLastName){#ifdef _WIN_ALL // If we are in Windows, let's try Unicode path first. In Unix we do not // need it (Unix MakeDir will fails with Unicode only name). if (PathW!=NULL && *PathW!=0) return(CreatePath(PathW,SkipLastName));#endif if (Path!=NULL && *Path!=0) return(CreatePath(Path,SkipLastName)); return(false);}
开发者ID:ajnelson,项目名称:bulk_extractor,代码行数:12,
示例6: mainint main(){ scanf("%d%d",&n,&m); AdjacentMatrix.Size = n; for(int i = 0; i < m; i++){ int start,end; scanf("%d%d",&start,&end); CreatePath(start,end); CreatePath(end,start); } int ans = BFS(n); printf("%d/n",ans); return 0;}
开发者ID:hellozts4120,项目名称:data-structure,代码行数:13,
示例7: TESTTEST(utilities, DebugLfpOutputDecimalFormat) { const char *filename = CreatePath("debug-output-lfp-dec", OUTPUT_DIR); InitDebugTest(filename); l_fp test; test.l_ui = 6310; // 0x000018A6 test.l_uf = 308502; // 0x00004B516 l_fp network; HTONL_FP(&test, &network); l_fp_output_dec(&network, outputFile); FinishDebugTest(CreatePath("debug-input-lfp-dec", INPUT_DIR), filename);}
开发者ID:traveller42,项目名称:ntpsec,代码行数:15,
示例8: M_GetConfigPathFString M_GetConfigPath(bool for_reading){ FString path; // Construct a user-specific config name if (UseKnownFolders() && GetKnownFolder(CSIDL_APPDATA, FOLDERID_RoamingAppData, true, path)) { path += "/" GAME_DIR; CreatePath(path); path += "/" GAMENAMELOWERCASE ".ini"; } else { path = progdir; path += GAMENAMELOWERCASE ".ini"; } // If we are reading the config file, check if it exists. If not, fallback // to $PROGDIR/zdoom.ini if (for_reading) { if (!FileExists(path)) { path = progdir; path << GAMENAMELOWERCASE ".ini"; } } return path;}
开发者ID:RusselCS,项目名称:TheEntireGreekAlphabet,代码行数:30,
示例9: GetNewNameForFileDigit TString GetNewNameForFileDigit(const TPath &oldPath, const TString &nameWithoutDigit, __int64 & counter, size_t & leadingZeros, const TPath &pathForRename) { TString pathWithDigit; const int BUFFER_SIZE = 65; char buffer[BUFFER_SIZE]; TString leadingZeroString; counter++; if (leadingZeros > 0) { if (LengthOfLong(counter) > LengthOfLong(counter - 1)) //если цифра удленилась leadingZeros--; for (size_t i = 0; i < leadingZeros; i++) leadingZeroString.push_back('0'); } if (_i64toa_s(counter, buffer, BUFFER_SIZE, 10) == 0) { pathWithDigit = CreatePath(oldPath.GetDirectory(), nameWithoutDigit + leadingZeroString + TString(buffer) + oldPath.GetExtension()); if(TPath::EqualByNameWithExtension(pathWithDigit, pathForRename)) return pathForRename.Original(); if (IsFileExists(pathWithDigit.c_str())) //если такой файл уже есть, то не увеличиваем номер, а добавляем _2 return GetNewNameForFileAdd(oldPath); } else return GetNewNameForFileAdd(oldPath); return pathWithDigit; }
开发者ID:flying19880517,项目名称:AntiDupl,代码行数:28,
示例10: whilevoid BezierController::CheckCreatePath(){ bool shouldCreatePath = false; CurveNode* current = mStartNode.get(); while (current) { if (current->GetDirtyFlag()) { shouldCreatePath = true; current->SetDirtyFlag(false); //note: we wont break cause we need //to reset all dirty flags } current = current->GetNext(); } if (shouldCreatePath) { CreatePath(); ResetIterators(); }}
开发者ID:VRAC-WATCH,项目名称:deltajug,代码行数:25,
示例11: FinishSprite/* ============== FinishSprite ============== */void FinishSprite( void ){ FILE *spriteouthandle; int i, curframe; dsprite_t spritetemp; char savename[1024]; if ( sprite.numframes == 0 ) { return; } if ( !strlen( spritename ) ) { Error( "Didn't name sprite file" ); } sprintf( savename, "%s%s.sp2", gamedir, spritename ); if ( g_release ) { char name[1024]; sprintf( name, "%s.sp2", spritename ); ReleaseFile( name ); spritename[0] = 0; // clear for a new sprite sprite.numframes = 0; return; } printf( "saving in %s/n", savename ); CreatePath( savename ); spriteouthandle = SafeOpenWrite( savename );//// write out the sprite header// spritetemp.ident = LittleLong( IDSPRITEHEADER ); spritetemp.version = LittleLong( SPRITE_VERSION ); spritetemp.numframes = LittleLong( sprite.numframes ); SafeWrite( spriteouthandle, &spritetemp, 12 );//// write out the frames// curframe = 0; for ( i = 0 ; i < sprite.numframes ; i++ ) { frames[i].width = LittleLong( frames[i].width ); frames[i].height = LittleLong( frames[i].height ); frames[i].origin_x = LittleLong( frames[i].origin_x ); frames[i].origin_y = LittleLong( frames[i].origin_y ); } SafeWrite( spriteouthandle, frames, sizeof( frames[0] ) * sprite.numframes ); fclose( spriteouthandle ); spritename[0] = 0; // clear for a new sprite sprite.numframes = 0;}
开发者ID:Garux,项目名称:netradiant-custom,代码行数:65,
示例12: ExtractLinkbool ExtractLink(ComprDataIO &DataIO,Archive &Arc,const char *LinkName,uint &LinkCRC,bool Create){#if defined(SAVE_LINKS) && defined(_UNIX) char LinkTarget[NM]; if (IsLink(Arc.NewLhd.FileAttr)) { int DataSize=Min(Arc.NewLhd.PackSize,sizeof(LinkTarget)-1); DataIO.UnpRead((byte *)LinkTarget,DataSize); LinkTarget[DataSize]=0; if (Create) { CreatePath(LinkName,NULL,true); if (symlink(LinkTarget,LinkName)==-1) // Error. if (errno==EEXIST) Log(Arc.FileName,St(MSymLinkExists),LinkName); else { Log(Arc.FileName,St(MErrCreateLnk),LinkName); ErrHandler.SetErrorCode(RARX_WARNING); } // We do not set time of created symlink, because utime changes // time of link target and lutimes is not available on all Linux // systems at the moment of writing this code. } int NameSize=Min(DataSize,strlen(LinkTarget)); LinkCRC=CRC(0xffffffff,LinkTarget,NameSize); return(true); }#endif return(false);}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:31,
示例13: M_GetSavegamesPathFString M_GetSavegamesPath(){ FString path; if (!UseKnownFolders()) { return progdir; } // Try standard Saved Games folder else if (GetKnownFolder(-1, FOLDERID_SavedGames, true, path)) { path << "/" GAMENAME; } // Try defacto My Documents/My Games folder else if (GetKnownFolder(CSIDL_PERSONAL, FOLDERID_Documents, true, path)) { // I assume since this isn't a standard folder, it doesn't have // a localized name either. path << "/My Games/" GAMENAME; CreatePath(path); } else { path = progdir; } return path;}
开发者ID:Marqt,项目名称:ViZDoom,代码行数:27,
示例14: GetNameFromAbsNameBOOL CommonStrMethod::CreateFile(CString strFile){ CString strFileName = GetNameFromAbsName(strFile); CString strPath = GetPathFromAbsName(strFile); if(!IsAbsPath(strPath)) { if(strPath.GetLength() > 0) { if(strPath.GetAt(0) == _T('//') || strPath.GetAt(0) == _T('/')) { strPath.Delete(0); } } strPath = GetModuleDir() + strPath; } if(!CreatePath(strPath)) { return FALSE; } HANDLE hFile = ::CreateFile(strPath + strFileName, GENERIC_ALL, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); if(hFile == INVALID_HANDLE_VALUE) { return FALSE; } ::CloseHandle(hFile); return TRUE;}
开发者ID:Forlearngit,项目名称:HallQueFront,代码行数:30,
示例15: GetModuleFileNamevoid CScatteredManage::init(){ char startup_dir[MAX_PATH]; pgrid_util::Singleton<BIN_DIR>::instance(); GetModuleFileName(NULL,(char*)(void*)pgrid_util::Singleton<BIN_DIR>::instance(),MAX_PATH); GetModuleFileName(NULL,startup_dir,MAX_PATH); _tcsrchr(startup_dir,'//')[1] = 0; _tcsrchr((char*)(void*)pgrid_util::Singleton<BIN_DIR>::instance(),'//')[1] = 0; strcat(startup_dir,"ScatterProgams"); if(!IsExistDir(startup_dir)) { if(!CreatePath(startup_dir)) { NPLogError(("创建SCATTERED模块目录失败/n")); return; } } //遍历搜索目录 获取模块信息 //模块名+版本号 RegisterModules(startup_dir); //debug 输出启动注册的模块 for(MNG_IT it= m_modules.begin();it!=m_modules.end();++it) { printf("%lld,%s/n",it->first,it->second.moduleTag.name.Get()); } //debug}
开发者ID:niwho,项目名称:pcc,代码行数:29,
示例16: GetTextExtentvoidwxGraphicsContext::DoDrawFilledText(const wxString &str, wxDouble x, wxDouble y, const wxGraphicsBrush& backgroundBrush){ wxGraphicsBrush formerBrush = m_brush; wxGraphicsPen formerPen = m_pen; wxDouble width; wxDouble height; wxDouble descent; wxDouble externalLeading; GetTextExtent( str , &width, &height, &descent, &externalLeading ); SetBrush( backgroundBrush ); // to make sure our 'OffsetToPixelBoundaries' doesn't move the fill shape SetPen( wxNullGraphicsPen ); wxGraphicsPath path = CreatePath(); path.AddRectangle( x , y, width, height ); FillPath( path ); DrawText( str, x ,y); SetBrush( formerBrush ); SetPen( formerPen );}
开发者ID:DumaGit,项目名称:winsparkle,代码行数:25,
示例17: CreatePathvoid wxGraphicsContext::StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2){ wxGraphicsPath path = CreatePath(); path.MoveToPoint(x1, y1); path.AddLineToPoint( x2, y2 ); StrokePath( path );}
开发者ID:252525fb,项目名称:rpcs3,代码行数:7,
示例18: AfxGlobal_createPathstatic JSBoolAfxGlobal_createPath(JSContext *cx, unsigned argc, JS::Value *vp){ JS::CallArgs args = JS::CallArgsFromVp(argc, vp); if(1 > args.length()) return JS_FALSE; JSString *str = JS_ValueToString(cx, args[0]); if (!str) return JS_FALSE; char *c_str = JS_EncodeString(cx, str); if(!c_str) return JS_FALSE; bool bOk = false; std::wstring wPath; std::string path; if(AnsiStringToWideString(c_str, wPath) && CreatePath(wPath.c_str(), wPath) && WideStringToAnsiString(wPath.c_str(), path)) { JSString * str = JS_NewStringCopyZ(cx, path.c_str()); args.rval().set(STRING_TO_JSVAL(str)); } else args.rval().set(JSVAL_NULL); JS_free(cx, c_str); return JS_TRUE;}
开发者ID:YaLTeR,项目名称:advancedfx,代码行数:35,
示例19: GetTextExtentvoid wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle, const wxGraphicsBrush& backgroundBrush ){ wxGraphicsBrush formerBrush = m_brush; wxGraphicsPen formerPen = m_pen; wxDouble width; wxDouble height; wxDouble descent; wxDouble externalLeading; GetTextExtent( str , &width, &height, &descent, &externalLeading ); SetBrush( backgroundBrush ); // to make sure our 'OffsetToPixelBoundaries' doesn't move the fill shape SetPen( wxNullGraphicsPen ); wxGraphicsPath path = CreatePath(); path.MoveToPoint( x , y ); path.AddLineToPoint( (int) (x + sin(angle) * height) , (int) (y + cos(angle) * height) ); path.AddLineToPoint( (int) (x + sin(angle) * height + cos(angle) * width) , (int) (y + cos(angle) * height - sin(angle) * width)); path.AddLineToPoint((int) (x + cos(angle) * width) , (int) (y - sin(angle) * width) ); FillPath( path ); DrawText( str, x ,y, angle); SetBrush( formerBrush ); SetPen( formerPen );}
开发者ID:252525fb,项目名称:rpcs3,代码行数:26,
示例20: test_WriteFileWithMultipleEntriesvoidtest_WriteFileWithMultipleEntries(void) { kod_db_file = estrdup("kod-output-multiple"); add_entry("example.com", "RATE"); add_entry("192.0.2.1", "DENY"); add_entry("192.0.2.5", "RSTR"); // // Manipulate timestamps. This is a bit of a hack, ideally these // tests should not care about the internal representation. // kod_db[0]->timestamp = 0xabcd; kod_db[1]->timestamp = 0xabcd; kod_db[2]->timestamp = 0xabcd; write_kod_db(); // Open file and compare sizes and content. FILE * actual = fopen(kod_db_file, "rb"); FILE * expected = fopen(CreatePath("kod-expected-multiple", INPUT_DIR),"rb"); TEST_ASSERT_NOT_NULL(actual); TEST_ASSERT_NOT_NULL(expected); TEST_ASSERT_EQUAL(GetFileSize(expected), GetFileSize(actual)); TEST_ASSERT_TRUE(CompareFileContent(expected, actual));}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:29,
示例21: ExtractLinkint ExtractLink(ComprDataIO &DataIO,Archive &Arc,char *DestName,unsigned int &LinkCRC,bool Create){#if defined(SAVE_LINKS) && defined(_UNIX) char FileName[NM]; if (IsLink(Arc.NewLhd.FileAttr)) { int DataSize=Min(Arc.NewLhd.PackSize,sizeof(FileName)-1); DataIO.UnpRead((unsigned char *)FileName,DataSize); FileName[DataSize]=0; if (Create) { CreatePath(DestName,NULL,true); if (symlink(FileName,DestName)==-1) if (errno==EEXIST) Log(Arc.FileName,St(MSymLinkExists),DestName); else { Log(Arc.FileName,St(MErrCreateLnk),DestName); ErrHandler.SetErrorCode(WARNING); } } LinkCRC=CRC(0xffffffff,FileName,DataSize); return(1); }#endif return(0);}
开发者ID:BITINT,项目名称:DEFCON2,代码行数:27,
示例22: test_ReadEmptyKeyFilevoid test_ReadEmptyKeyFile() { struct key* keys = NULL; TEST_ASSERT_EQUAL(0, auth_init(CreatePath("key-test-empty", INPUT_DIR), &keys)); TEST_ASSERT_TRUE(keys == NULL);}
开发者ID:sambuc,项目名称:netbsd,代码行数:7,
示例23: _tcsrchrvoid AutoReplaceMap::writeAutoReplaceMap(){ // Create path TCHAR *p = _tcsrchr(filename, _T('//')); if (p != NULL) { *p = 0; CreatePath(filename); *p = _T('//'); } // Write it FILE *file = _tfopen(filename, _T("wb")); if (file != NULL) { map<tstring,AutoReplacement>::iterator it = replacements.begin(); for(; it != replacements.end(); it++) { AutoReplacement &ar = it->second; TcharToUtf8 find(it->first.c_str()); TcharToUtf8 replace(ar.replace.c_str()); if (ar.useVariables) fprintf(file, "%s-V>%s/n", (const char *)find, (const char *)replace); else fprintf(file, "%s->%s/n", (const char *)find, (const char *)replace); } fclose(file); }}
开发者ID:Robyer,项目名称:miranda-plugins,代码行数:31,
示例24: test_ReadHexKeysvoid test_ReadHexKeys() { struct key* keys = NULL; TEST_ASSERT_EQUAL(3, auth_init(CreatePath("key-test-hex", INPUT_DIR), &keys)); TEST_ASSERT_TRUE(keys != NULL); struct key* result = NULL; get_key(10, &result); TEST_ASSERT_TRUE(result != NULL); TEST_ASSERT_TRUE(CompareKeysAlternative(10, 13, "MD5", "/x01/x23/x45/x67/x89/xab/xcd/xef/x01/x23/x45/x67/x89", *result)); result = NULL; get_key(20, &result); TEST_ASSERT_TRUE(result != NULL); char data1[15]; memset(data1, 0x11, 15); TEST_ASSERT_TRUE(CompareKeysAlternative(20, 15, "MD5", data1, *result)); result = NULL; get_key(30, &result); TEST_ASSERT_TRUE(result != NULL); char data2[13]; memset(data2, 0x01, 13); TEST_ASSERT_TRUE(CompareKeysAlternative(30, 13, "MD5", data2, *result));}
开发者ID:sambuc,项目名称:netbsd,代码行数:25,
示例25: psLinearPathpsPath* psPathNetwork::CreatePath(iDataConnection *db, const csString& name, Waypoint* wp1, Waypoint* wp2, const csString& flags){ psPath * path = new psLinearPath(name,wp1,wp2,flags); return CreatePath(db, path);}
开发者ID:Chettie,项目名称:Eulora-client,代码行数:7,
示例26: TESTTEST(keyFile, ReadHexKeys) { const char* path; struct key* keys = NULL; struct key* result = NULL; char data[15]; path = CreatePath("key-test-hex", INPUT_DIR); TEST_ASSERT_EQUAL(3, auth_init(path, &keys)); free((void*) path); TEST_ASSERT_TRUE(keys != NULL); get_key(10, &result); TEST_ASSERT_TRUE(result != NULL); TEST_ASSERT_TRUE(CompareKey(10, 13, "MD5", "/x01/x23/x45/x67/x89/xab/xcd/xef/x01/x23/x45/x67/x89", result)); result = NULL; get_key(20, &result); TEST_ASSERT_TRUE(result != NULL); memset(data, 0x11, 15); TEST_ASSERT_TRUE(CompareKey(20, 15, "MD5", data, result)); result = NULL; get_key(30, &result); TEST_ASSERT_TRUE(result != NULL); memset(data, 0x01, 13); TEST_ASSERT_TRUE(CompareKey(30, 13, "MD5", data, result));}
开发者ID:traveller42,项目名称:ntpsec,代码行数:29,
注:本文中的CreatePath函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CreatePatternBrush函数代码示例 C++ CreatePalette函数代码示例 |