Welcome![Sign In][Sign Up]
Location:
Search - readdir opendir

Search list

[Linux-Unixunix仿真

Description: provides implementations of the following UNIX APIs: chdir(), getcwd(), mkdir(), rmdir() dlopen(), dlclose(), dlsym(), dlerror() getpagesize() gettimeofday() link(), unlink() glob(), globfree() mmap(), munmap(), msync() opendir(), readdir(), rewinddir(), closedir() pathconf(), realpath() readv(), writev()
Platform: | Size: 742599 | Author: hqsun_sohu@sohu.com | Hits:

[Game Programmd3loader

Description: Quake 3 s MD3 Viewer (july 13, 2007), loads and displays a player and a weapon. Supports lighting, texture mapping and animation. Includes a sample player model with weapon. See README for how to use it. Note (1): it uses the POSIX opendir/readdir functions, which are not implemented in all compilers under Windows (MinGW supports them). Note (2): This demo works on little endian architectures only. Libraries: OpenGL, GLU, GLUT, boost, libjpeg. Files: md3loader.zip (2.4 MB)-Quake 3 s MD3 Viewer (july 13, 2007), loads and displays a player and a weapon. Supports lighting, texture mapping and animation. Includes a sample player model with weapon. See README for how to use it. Note (1): it uses the POSIX opendir/readdir functions, which are not implemented in all compilers under Windows (MinGW supports them). Note (2): This demo works on little endian architectures only. Libraries: OpenGL, GLU, GLUT, boost, libjpeg. Files: md3loader.zip (2.4 MB)
Platform: | Size: 2507776 | Author: futuh | Hits:

[Linux-Unixtaoqianzimulu

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:

[Linux-Unixtest25

Description: 1.编写程序,从指定目录文件开始,打印目录文件树(opendir, readdir); 2.编写程序,打印指定目录文件下的所有的文件(readdir),同时标识除文件的类型(stat); 3.编写程序,在指定目录文件下创建一个新文件,删除一个指定文件,拷贝指定文件;-Write a program file from the specified directory, print directory file tree (the opendir, the fashion in which readdir) programming, print all the files under the specified directory file (readdir), while logo In addition to the file type (stat) programmingcreate a new file in the specified directory file, delete a specific file, copy the specified file
Platform: | Size: 1024 | Author: 丁占成 | Hits:

[File Operate1234

Description: 完成一个目录复制命令mycp,包括目录下的文件和子目录, 运行结果如下: beta@bugs.com [~/]# ls -l sem total 56 drwxr-xr-x3 beta beta 4096 Dec 19 02:53 ./ drwxr-xr-x8 beta beta 4096 Nov 27 08:49 ../ -rw-r r 1 beta beta128 Nov 27 09:31 Makefile -rwxr-xr-x1 beta beta 5705 Nov 27 08:50 consumer* -rw-r r 1 beta beta349 Nov 27 09:30 consumer.c drwxr-xr-x2 beta beta 4096 Dec 19 02:53 subdir/ beta@bugs.com [~/]# mycp sem target beta@bugs.com [~/]# ls -l target total 56 drwxr-xr-x3 beta beta 4096 Dec 19 02:53 ./ drwxr-xr-x8 beta beta 4096 Nov 27 08:49 ../ -rw-r r 1 beta beta128 Nov 27 09:31 Makefile -rwxr-xr-x1 beta beta 5705 Nov 27 08:50 consumer* -rw-r r 1 beta beta349 Nov 27 09:30 consumer.c drwxr-xr-x2 beta beta 4096 Dec 19 02:53 subdir/ 说明: Linuk: mkdir,opendir,readdir,symlink,readlink等系统调用 Windows:CreateDirectory,FindFirstFile,FindNextFile等函数-Complete a directory replication command mycp, including files and subdirectories, operating results are as follows: beta@bugs.com [~ /]# ls-l sem total 56 drwxr-xr-x3 beta beta 4096 Dec 19 02:53 ./ drwxr-xr-x8 beta beta 4096 Nov 27 08:49 ../-rw-r- r- 1 beta beta128 Nov 27 09:31 Makefile-rwxr-xr-x1 beta beta 5705 Nov 27 08:50 consumer*-rw-r- r- 1 beta beta349 Nov 27 09:30 consumer.c drwxr-xr-x2 beta beta 4096 Dec 19 02:53 subdir/beta@bugs.com [~ /]# mycp sem target beta @ bugs.com [~ /]# ls-l target total 56 drwxr-xr-x3 beta beta 4096 Dec 19 02:53 ./ drwxr-xr-x8 beta beta 4096 Nov 27 08:49 ../-rw-r r- 1 beta beta128 Nov 27 09:31 Makefile-rwxr-xr-x1 beta beta 5705 Nov 27 08:50 consumer*-rw-r- r- 1 beta beta349 Nov 27 09:30 consumer.c drwxr-xr-x2 beta beta 4096 Dec 19 02:53 subdir/Description: Linuk: mkdir, opendir, readdir, symlink, readlink system calls Windows: CreateDirectory, FindFirstFile, FindNextFile and other functions
Platform: | Size: 5120 | Author: 于冰 | Hits:

[Linux-Unixls

Description: 使用opendir、readdir、closedir等函数来操作目录,使用stat函数来获取文件信息。编写一个功能完整的实现Unix/Linux下ls命令的程序,并且该程序实现了-l(长格式)选项功能,并能在Unix/Linux环境下正确地运行。-Use opendir, readdir, close to operate functions such as directory, use the stat function to get file information. Write a full-featured implementation of programs Unix/Linux under the ls command, and the program implements the-l (long format) option function, and can run correctly under Unix/Linux environment.
Platform: | Size: 1024 | Author: Selena Wang | Hits:

CodeBus www.codebus.net