This is my problem:
I'm trying to read the contents of a directory recursively and below is my code so far... I'm sure I have a lot of mistakes but could anyone help me? When I run this program I get Segmentation fault ! What should I do???
struct dirent* pdirent;
struct stat Stat;
void perform( char* A )
if(stat(A , &Stat) < 0)
directory = opendir(A);
while( (pdirent = readdir(directory)) != NULL)
if((pdirent -> d_name != ".") && (pdirent->d_name != ".."))
printf("%s \n" , pdirent -> d_name);
In main I call perform( argv )
I'd appreciate any help !!!