|
|
发表于 2020-2-11 09:32:37
|
显示全部楼层
test01.c: In function ‘findAllDirs’:
test01.c:65: error: ‘entry_’ undeclared (first use in this function)
test01.c:65: error: (Each undeclared identifier is reported only once
test01.c:65: error: for each function it appears in.)
test01.c:65: error: ‘d_name’ undeclared (first use in this function)
test01.c:81:8: warning: multi-character character constant
test01.c:81: warning: passing argument 1 of ‘chdir’ makes pointer from integer without a cast
/usr/include/unistd.h:494: note: expected ‘const char *’ but argument is of type ‘int’
、
void findAllDirs(const char *path)
{
DIR *dp;
struct dirent *entry;
struct stat statbuf;
if((dp = opendir(path)) == NULL)
{
fprintf(stderr, "The path %s is wrong! \n",path);
return;
}
chdir(path);
while ((entry = readdir(dp)) != NULL )
{
lstat(entry->d_name, &statbuf);
if(!strcmp(".",entry->d_name) || !strcmp("..",entry_>d_name))
continue;
if(S_ISDIR(statbuf.st_mode))
{
findAllDirs(entry->d_name);
|
|