Nov 3, 2009 at 5:56pm UTC
readdir() only returns one directory entry at a time.
You have to keep calling readdir() until it returns 0, which indicates that there are no more entries.
man 2 readdir
Nov 4, 2009 at 6:23pm UTC
can you please show me how exactly tis can be done.
Nov 4, 2009 at 7:56pm UTC
Put line 10 in the loop and break the loop when drnt is false
Nov 9, 2009 at 5:20pm UTC
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..
Nov 9, 2009 at 5:26pm UTC
will always be
as it is an array. If the loops continues when
is equal to
, when you attempt to access its members ( eg: ) you will get the segmentation fault
Nov 10, 2009 at 1:14pm UTC
bazzy.. u have any link to documents or code sample.As i follow your while (true) it shows error on compilation..