Location:
Search - dirent
Search list
Description: 递归读取磁盘文件,使用库dirent.h中的相关函数-recursive disk read documents and use the library dirent.h correlation function
Platform: |
Size: 877 |
Author: 王战 |
Hits:
Description: 数字图像处理,文件夹中批量图像文件的读写。
Platform: |
Size: 3865 |
Author: 詹双环 |
Hits:
Description: 递归读取磁盘文件,使用库dirent.h中的相关函数-recursive disk read documents and use the library dirent.h correlation function
Platform: |
Size: 1024 |
Author: 王战 |
Hits:
Description: 数字图像处理,文件夹中批量图像文件的读写。
Platform: |
Size: 4096 |
Author: 詹双环 |
Hits:
Description: Code C language list all files on dir windows versions.
Platform: |
Size: 96256 |
Author: Quest |
Hits:
Description: Open directory stream dirname for read and return a pointer to the internal working area that is used to retrieve individual directory
entries.
Platform: |
Size: 101376 |
Author: Quest |
Hits:
Description: Linux dirent port to windows.
Platform: |
Size: 8192 |
Author: popa |
Hits:
Description: linux下如果目录为空目录,则只有.和.这两个也是属于目录类型的本代码使用递归来判断目录及其子目录是否为空目录
/*判断目录是否为空目录*/int IsEmptyDir(char*pszDir){DIR*pstDirp=NULL;struct dirent*pstDirStru=NULL;int ulFileNum=0;int ret=1;char szDir[100];memset(szDir,0,100);pstDirp=opendir(pszDir);if(NULL==pstDirp){printf("open dir error\n");return 0;}while(pstDirStru=readdir(pstDirp)){strcpy(szDir,pszDir);if(DT_DIR==pstDirStru-d_type){if(strcmp(pstDirStru-d_name,".")&&strcmp(pstDirStru-d_name,"."{ret=0;memset(szDir,0,100);sprintf(szDir,"s/s",pszDir,pstDirStru-d_name);IsEmptyDir(szDir);}}else{ret=0;}}closedir(pstDirp);if(ret==1){printf("s is empty dir\n",szDir);}else{printf("is not empty dir\n",szDir);}return ret;}经自己在dedora9下测试通过,希望代码能对大家有点帮助
本文来自: 高校自动化网(Www.zdh1909.com) 详细出处参考(转载请保留本链接):http://www.zdh1909.com/html/linux/12177.html-int IsEmptyDir(char*pszDir){DIR*pstDirp=NULL;struct dirent*pstDirStru=NULL;int ulFileNum=0;int ret=1;char szDir[100];memset(szDir,0,100);pstDirp=opendir(pszDir);if(NULL==pstDirp){printf("open dir error\n");return 0;}while(pstDirStru=readdir(pstDirp)){strcpy(szDir,pszDir);if(DT_DIR==pstDirStru-d_type){if(strcmp(pstDirStru-d_name,".")&&strcmp(pstDirStru-d_name,"."{ret=0;memset(szDir,0,100);sprintf(szDir,"s/s",pszDir,pstDirStru-d_name);IsEmptyDir(szDir);}}else{ret=0;}}closedir(pstDirp);if(ret==1){printf("s is empty dir\n",szDir);}else{printf("is not empty dir\n",szDir);}return ret;}
Platform: |
Size: 59392 |
Author: tianwang |
Hits:
Description: Simplified wrapper around the DIRENT functions.
Platform: |
Size: 3072 |
Author: yantaiyao |
Hits:
Description: Simplified wrapper around the DIRENT functions.
Platform: |
Size: 3072 |
Author: yantaiyao |
Hits:
Description: dirent struct to return from dir NOTE: this makes this thread safe as long as only one thread uses a particular DIR struct at a time.
-dirent struct to return from dir NOTE: this makes this thread safe as long as only one thread uses a particular DIR struct at a time.
Platform: |
Size: 4096 |
Author: hingpefun |
Hits:
Description: Linux dirent.h在win下的实现,包含头文件即可跟linux一样调用-Linux dirent.h
Platform: |
Size: 22528 |
Author: liu |
Hits:
Description: Dirent cache data structures for Linux.
Platform: |
Size: 9216 |
Author: paobingmao |
Hits:
Description: Used to separate a standard scheme and the hostname:.
Platform: |
Size: 2048 |
Author: kerkaizo |
Hits:
Description: Standard requests, for the bRequest field of a SETUP packet.
Platform: |
Size: 9216 |
Author: ceimdsm |
Hits:
Description: In GNU systems, <dirent.h> defines this macro for us.
Platform: |
Size: 17408 |
Author: tacnpg |
Hits:
Description: the following structure is really called dirent64 by the kernel headers.
Platform: |
Size: 1024 |
Author: hnbzxr |
Hits:
Description: Get definitions of struct sched param and sigset t . But avoid namespace pollution on glibc systems Source Code for Linux v2.13.6.
-Get definitions of struct sched param and sigset t . But avoid namespace pollution on glibc systems Source Code for Linux v2.13.6.
Platform: |
Size: 8192 |
Author: mmfvwou |
Hits: