C++ _rmdir函数代码示例 - 纯净天空 (2024)

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

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


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

示例1: teardown_test

int teardown_test(void){ char dirname[_MAX_PATH]; size_t len; int i; printf ("Begin cleanup...\n"); if (_getcwd(dirname, sizeof(dirname)/sizeof(char)) != NULL && (len = strlen(dirname)) > sizeof(TESTDIR)/sizeof(char) && !strcmp(dirname + len + 1 - sizeof(TESTDIR)/sizeof(char), TESTDIR)) { /* fallthrough */ } else { /* did we create the directory? */ if (!_rmdir( TESTDIR )) { fprintf(stderr, "Removed test directory\n"); return 0; } else { if (errno == ENOTEMPTY) { if (_chdir(TESTDIR)) { fprintf(stderr, "Can't change to test directory. Aborting cleanup.\n"); return -1; } else { /* fallthrough */ } } else { return -1; } } } fprintf(stderr, "Cleaning up test directory %s ...\n", TESTDIR); for (i=0; i < n_dir_entries; i++) { if (_unlink(dir_entries[i])) { /* if the test setup failed, we expect this to happen for at least some files */ } } if (_chdir("..")) { fprintf(stderr, "Can't escape test directory. Giving in.\n"); return -1; } if (_rmdir( TESTDIR )) { fprintf(stderr, "Can't remove test directory.\n"); return -1; } printf("Cleaned up test directory\n"); return 0;}

开发者ID:Henauxg,项目名称:minix,代码行数:58,代码来源:dirent-test.c


示例2: runSupFileServiceTests

static int runSupFileServiceTests (void) { printf ("==== SUP:FileService\n"); struct stat dirStat; BRFileService fs; char *path; char *currency = "btc", *network = "mainnet"; char *type1 = "foo"; // // Try to create a directory that is not writable; expect fileServiceCreate() to fail. // path = "private"; if (0 == stat (path, &dirStat)) _rmdir (path); if (0 != mkdir (path, 0000)) return 0; fs = fileServiceCreate(path, currency, network, NULL, NULL); if (NULL != fs) return fileServiceTestDone(path, 0); // // Create a directory that is writeable; expect fileServiceCreate to succeed. // if (0 == stat (path, &dirStat)) _rmdir (path); if (0 != mkdir (path, 0700)) return 0; fs = fileServiceCreate(path, currency, network, NULL, NULL); if (NULL == fs) return fileServiceTestDone(path, 0); // Confirm the full path exists. char fullpath[1024]; sprintf (fullpath, "%s/%s/%s", path, currency, network); if (0 != stat (fullpath, &dirStat)) return fileServiceTestDone (path, 0); // change the fullpath permissions; expect 'defineType' to fail. chmod (fullpath, 0000); if (1 == fileServiceDefineType(fs, type1, 0, NULL, NULL, NULL, NULL)) return fileServiceTestDone (path, 0); // and can't set the current version on a bad type if (1 == fileServiceDefineCurrentVersion(fs, type1, 0)) return fileServiceTestDone (path, 0); // change the permission to allow writing chmod (fullpath, 0700); if (1 != fileServiceDefineType(fs, type1, 0, NULL, NULL, NULL, NULL)) return fileServiceTestDone (path, 0); if (1 != fileServiceDefineCurrentVersion(fs, type1, 0)) return fileServiceTestDone (path, 0); // Good, finally. return fileServiceTestDone(path, 1);}

开发者ID:breadwallet,项目名称:breadwallet-core,代码行数:54,代码来源:testSup.c


示例3: removeDirectory

// Given a directory remove the files located within it and then the directory itselfvoid removeDirectory(std::string directory) {std::string CWD = getCurrentDirectory();directory = CWD + DIR_SEPARATOR + directory;WIN32_FIND_DATA data;HANDLE h = FindFirstFile((directory + DIR_SEPARATOR + "*").c_str(), &data);if (h != NULL) {SetFileAttributes(directory.c_str(), FILE_ATTRIBUTE_NORMAL);FindNextFile(h, &data); // ..FindNextFile(h, &data); // .do {std::string filename = directory + DIR_SEPARATOR + data.cFileName;if (!SetFileAttributes(filename.c_str(), FILE_ATTRIBUTE_NORMAL)) {logEvent(ERROR,filename + ": " + ConvertLastErrorToString());}int result = _unlink(filename.c_str());if (result != 0) {logEvent(ERROR, filename + ": " + ConvertLastErrorToString());}} while (FindNextFile(h,&data));FindClose(h);}_rmdir(directory.c_str());}

开发者ID:gabloe,项目名称:RapidStash,代码行数:26,代码来源:Testing.cpp


示例4: f_unlink

FRESULT f_unlink ( const XCHAR *path /* Pointer to the file or directory path */){ FRESULT ret = FR_OK; const char* target= createFullPath(path); if (-1 == stat(target, &stats)) { return cvtERRNO(); } if (stats.st_mode & S_IFDIR) { if (_rmdir(target) == -1) { ret = FR_DENIED; } } else { // a concatenation of the mmc dir & the requested path if (_unlink(target) == -1) { ret = cvtERRNO(); } } return ret;}

开发者ID:charlierobson,项目名称:EightyOne,代码行数:30,代码来源:ff.cpp


示例5: fileServiceTestDone

static intfileServiceTestDone (char *path, int success) { struct stat dirStat; if (0 == stat (path, &dirStat)) _rmdir (path); return success;}

开发者ID:breadwallet,项目名称:breadwallet-core,代码行数:7,代码来源:testSup.c


示例6: while

void MusicUtils::EmptyDir(CString Dir){CFileFind finder;CFile cfile;CString Add=L"\\*";CString DirSpec=Dir+Add; //????????????BOOL bWorking = finder.FindFile(DirSpec);while (bWorking){bWorking = finder.FindNextFile();if(!finder.IsDots()) //????????{if(finder.IsDirectory()) //????????{CString strDirectory = finder.GetFilePath();if(_rmdir((const char*)(LPSTR)(LPCTSTR)strDirectory)==-1){EmptyDir(strDirectory); }bWorking = finder.FindFile(DirSpec);}else //???????{cfile.Remove(finder.GetFilePath());}}}finder.Close();}

开发者ID:ltframe,项目名称:ltplayer0016,代码行数:33,代码来源:MusicUtils.cpp


示例7: defined

unsigned int CRhoFile::deleteEmptyFolder( const char* szFilePath ){#if defined(WINDOWS_PLATFORM) return (unsigned int)_rmdir(szFilePath);#else return (unsigned int)rmdir(szFilePath);#endif}

开发者ID:KlearXos,项目名称:rhodes,代码行数:7,代码来源:RhoFile.cpp


示例8: orxFile_Remove

/** Removes a file or an empty directory * @param[in] _zFileName Concerned file / directory * @return orxSTATUS_SUCCESS / orxSTATUS_FAILURE */orxSTATUS orxFASTCALL orxFile_Remove(const orxSTRING _zFileName){ orxSTATUS eResult = orxSTATUS_FAILURE; /* Checks */ orxASSERT((sstFile.u32Flags & orxFILE_KU32_STATIC_FLAG_READY) == orxFILE_KU32_STATIC_FLAG_READY); orxASSERT(_zFileName != orxNULL); /* Tries to remove it as a file */ if(remove(_zFileName) == 0) { /* Updates result */ eResult = orxSTATUS_SUCCESS; } else { /* Tries to remove it as a directory */#ifdef __orxWINDOWS__ if(_rmdir(_zFileName) == 0)#else /* __orxWINDOWS__ */ if(rmdir(_zFileName) == 0)#endif /* __orxWINDOWS__ */ { /* Updates result */ eResult = orxSTATUS_SUCCESS; } } /* Done! */ return eResult;}

开发者ID:iar-wain,项目名称:orx-test,代码行数:35,代码来源:orxFile.c


示例9: DelDB

 void DelDB(char* pDb) { char loc[256];char locfile[256];CFileFind finder;strcpy(locfile,pDb); //<---所要删除的目录的路径 strcpy(loc,pDb); //<---所要删除的目录的路径 strcat(locfile , "\\*.*"); //<---该目录下所有的文件int bWorking = finder.FindFile(locfile);while(bWorking){ bWorking = finder.FindNextFile(); if (finder.IsDots()) continue; if (!finder.IsDirectory()) { CString str = finder.GetFilePath(); CFile::Remove( str ); } }finder.Close(); //删除空目录---> if( _rmdir( loc ) == 0 ) std::cout<<"Directory "<<loc<<" was successfully removed\n"; else std::cout<<"Can not remove database"<<loc<<"\n"; ResetDBinfo(); //<---删除数据库之后将全局路径重新设置 }

开发者ID:V756568,项目名称:MiniSQL,代码行数:32,代码来源:Display.cpp


示例10: osDeleteDir

///////////////////////////////////////////////////////////////////////// Function:osDeleteDir// Description:Remove a directory// Return Value:-// Comments:voidosDeleteDir(const char *n){#ifdef _WINDOWS_rmdir(n);#elsermdir(n);#endif}

开发者ID:ataibarkai,项目名称:Pixie-iOS,代码行数:12,代码来源:os.cpp


示例11: deleteDirectory

void deleteDirectory( const char* szDirectory ){std::vector<std::string> aFileNames;getAllFilesInDirectory( szDirectory, aFileNames );char szFullPath[512];std::vector<std::string>::iterator iter = aFileNames.begin();for( ; iter != aFileNames.end(); ++iter ){const char* szFileName = (*iter).c_str();if( *iter != "." && *iter != ".." ){snprintf( szFullPath, sizeof( szFullPath ), "%s/%s/%s", getWriteDirectory(), szDirectory, szFileName );remove( szFullPath );}}// for iter = files names begin to endsnprintf( szFullPath, sizeof( szFullPath ), "%s/%s", getWriteDirectory(), szDirectory );#if defined( WIN32 )_rmdir( szFullPath );#elsermdir( szFullPath );#endif // WIN32}

开发者ID:wdings23,项目名称:gl-projects代码行数:32,代码来源:filepathutil.cpp


示例12: removeAllFiles

void removeAllFiles(const string source){_finddata_t *fileinfo = new _finddata_t;string mask = parser(source);int done, checker;done = _findfirst(mask.c_str(), fileinfo);if (done == -1){throw exception("cant open remove directory!\n");}while ((strcmp(fileinfo->name, ".") == 0) || (strcmp(fileinfo->name, "..") == 0)){checker = _findnext(done, fileinfo);}string src, filename;while (checker != -1){while (checker != -1 && fileinfo->attrib &_A_SUBDIR){src = source + fileinfo->name + "\\";removeAllFiles(src);if (_rmdir(src.c_str()) == -1){throw exception("cant remove directory!\n");}checker = _findnext(done, fileinfo);}if (checker != -1){filename = source + fileinfo->name;if (remove(filename.c_str()) != 0){throw exception("cant remove file!\n");}checker = _findnext(done, fileinfo);}}delete fileinfo;_findclose(done);}

开发者ID:Feliasfogg,项目名称:HomeWorks,代码行数:32,代码来源:removeAllFiles.cpp


示例13: os_rmdir

int os_rmdir(const char * name){#if ( defined _WIN32 || defined WIN32 ) return _rmdir(name);#else return rmdir(name);#endif};

开发者ID:bjarneh,项目名称:organice,代码行数:7,代码来源:specific.c


示例14: UT_DeleteDir

/*AR-921013CH UT_DeleteDir Sletter et directoryCD ==================================================================CD Formål:CD Sletter et directory.CDCD PARAMETERLISTE:CD Type Navn I/U MerknadCD ------------------------------------------------------------------CD char *pszPath i Directory-navnCD short sStatus r Status; 0=OK, annen verdi er feil.CDCD Bruk: sStatus = UT_DeleteDir(szPath); ==================================================================*/SK_EntPnt_UT short UT_DeleteDir(char *pszPath){#ifdef LINUXreturn (short)rmdir(pszPath);#endif#ifdef UNIXreturn (short)rmdir(pszPath);#endif#ifdef OS232 return (short)DosDeleteDir(pszPath);#endif#ifdef OS216 return (short)rmdir(pszPath);#endif#ifdef WIN32 return (short)_rmdir(pszPath);#endif#ifdef BORLANDreturn (short)rmdir(pszPath);#endif}

开发者ID:Brainiarc7,项目名称:fyba,代码行数:42,代码来源:DELDIR.cpp


示例15: main

intmain(int argc, char *argv[]){ int c; static struct option const long_options[] = { {"help", 0, NULL, 'h'}, {NULL, 0, NULL, 0} }; exit_status = 0; program_name = argv[0]; while((c = getopt_long(argc, argv, "hH", long_options, NULL)) != -1) { switch(c) { case 'h': case 'H': rmdir_usage_exit(EXIT_SUCESS); break; default: rmdir_usage_exit(EXIT_FAILURE); break; } } if(optind == argc) rmdir_usage_exit(EXIT_FAILURE); while(optind < argc) exit_status = _rmdir(argv[optind++]); exit(exit_status);}

开发者ID:lufb,项目名称:code,代码行数:35,代码来源:rmdir.c



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

C++ _rmdir函数代码示例 - 纯净天空 (2024)
Top Articles
Latest Posts
Article information

Author: Rob Wisoky

Last Updated:

Views: 5641

Rating: 4.8 / 5 (48 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Rob Wisoky

Birthday: 1994-09-30

Address: 5789 Michel Vista, West Domenic, OR 80464-9452

Phone: +97313824072371

Job: Education Orchestrator

Hobby: Lockpicking, Crocheting, Baton twirling, Video gaming, Jogging, Whittling, Model building

Introduction: My name is Rob Wisoky, I am a smiling, helpful, encouraging, zealous, energetic, faithful, fantastic person who loves writing and wants to share my knowledge and understanding with you.