void showAllFiles( const char * dir_name)
{
if( NULL == dir_name )
{
cout<<" dir_name is null ! "<<endl;
return;
}
struct stat s;
lstat( dir_name , &s );
if( ! S_ISDIR( s.st_mode ) )
{
return;
}
struct dirent * filename;
DIR * dir;
dir = opendir( dir_name );
if( NULL == dir )
{
return;
}
int iName=0;
while( ( filename = readdir(dir) ) != NULL )
{
if( strcmp( filename->d_name , "." ) == 0 ||
strcmp( filename->d_name , "..") == 0)
continue;
char wholePath[128] = {0};
sprintf(wholePath, "%s/%s", dir_name, filename->d_name);
cout << "wholePath= " << wholePath << endl;
}
}
{
if( NULL == dir_name )
{
cout<<" dir_name is null ! "<<endl;
return;
}
struct stat s;
lstat( dir_name , &s );
if( ! S_ISDIR( s.st_mode ) )
{
return;
}
struct dirent * filename;
DIR * dir;
dir = opendir( dir_name );
if( NULL == dir )
{
return;
}
int iName=0;
while( ( filename = readdir(dir) ) != NULL )
{
if( strcmp( filename->d_name , "." ) == 0 ||
strcmp( filename->d_name , "..") == 0)
continue;
char wholePath[128] = {0};
sprintf(wholePath, "%s/%s", dir_name, filename->d_name);
cout << "wholePath= " << wholePath << endl;
}
}