There is a Book: Advance Programming in Unix Environment by Richard Stevens
in Chapter 2 i think there is a code that does the job of directory Listing
for given Directory

this is the code -> for directory listing

*#include <dirent.h>
int main(int argc, char *argv[])
{
    DIR *dp;
    struct dirent *dirp;
    if (argc != 2)
    err_quit("usage: ls directory_name");
    if ((dp = opendir(argv[1])) == NULL)
    err_sys("can't open %s", argv[1]);
    while ((dirp = readdir(dp)) != NULL)
    printf("%s\n", dirp->d_name);
    closedir(dp);
    exit(0);
}*


for this Question u just need to change this code and use recursion for
directory inside Directories
there are some attributes that are used to identify some object as file,
directory, root directory and parent directory. so in recursion u will take
care for those

On Wed, Jul 27, 2011 at 12:13 PM, geek forgeek <[email protected]>
wrote:
> anyone??
>
> On Tue, Jul 26, 2011 at 11:36 PM, geek forgeek <[email protected]>
> wrote:
>>
>> Function to display the directory structure in a user friendly way taking
>> root dir as arg
>> for a general OS. You may assume and state some basic APIs available in
>> that OS
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Sunny Aggrawal
B-Tech IV year,CSI
Indian Institute Of Technology,Roorkee

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to