Hi i am a relative newb to C programming, in a unix environment i am attempting to create a C program that does a recursive directory listing, functionaly similar to "ls -lR"
So far i have come up with this
Code:
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
int main( int argc, char* argv[] )
{
DIR * dir;
struct dirent * entry;
dir = opendir( argv[1] );
while ( entry=readdir( dir ) ) {
printf( "%s\n", entry->d_name );
}
closedir( dir );
return 0;
}
Does any1 have any ideas how i could improve this with the use of chdir, stat and any other procedures which could improve its performance???
any help would be greatly recieved
many thanks
laney