- 论坛徽章:
- 1
|
謝謝大家
#include<stdio.h>
#include <sys/types.h>
#include <dirent.h>
#include<stdlib.h>
#include <unistd.h>
#include<sys/stat.h>
#include<string.h>
void find( char *path, char *src)
{
DIR *tmpdp;
struct dirent *dirp;
char s[1000];
sprintf( s, "%s/%s", path, src);
if( (tmpdp=opendir( s)) == NULL ){
return;
}
fprintf( stderr, "%s\n", s );
while((dirp = readdir(tmpdp)) != NULL){
if (strcmp(dirp->d_name,".") == 0 || strcmp(dirp->d_name,"..") == 0)
continue;
find( s, dirp->d_name );
}
}
int main( int argc, void **argv )
{
find( "/home/freedino/", "test");
return 0;
}
謝謝你們的幫助,謝謝!! |
|