bazzy ..do u think this is causing the segmentation fault.?? i get all the directories listed but finally a segmentation fault..can you explain.. i am sorry if i have asked stupid question.. i am newbie..
dirn will always be != NULL as it is an array. If the loops continues when drnt is equal to , when you attempt to access its members ( eg: drnt->d_name ) you will get the segmentation fault