我试图改变这种代码可以找到在指定的目录和国家特定的文件是否是一个文件或使用执行opendir目录( );如何找到一个给定的目录中的特定文件,并检查它是否是一个文件或其他目录
我一直在寻找如何现在要做的这一段时间,但我似乎无法找到或理解这样做的一个简单的方法。
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
int main(int argc, char *argv[]){
DIR *dp;
struct dirent *dirp;
if(argc==1)
dp = opendir("./");
else
dp = opendir(argv[1]);
while ((dirp = readdir(dp)) != NULL)
printf("%s\n", dirp->d_name);
closedir(dp);
return 0;
}
发现_dir-path_ -name _ “文件” _ -print – BLUEPIXY 2014-09-21 04:28:07
我不明白你在说什么,对不起。我在系统编程方面很新颖。你能详细解释一下吗? – user4062234 2014-09-21 04:31:03
你不需要制作已经存在的东西。看到男人[发现](http://linux.die.net/man/1/find) – BLUEPIXY 2014-09-21 04:39:49