you can set your directory path in this line

char *home="/home/navin/temp/";

On Sun, Jun 3, 2012 at 11:26 AM, Navin Kumar <[email protected]>wrote:

>
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <sys/types.h>
> #include <dirent.h>
> #include <unistd.h>
> #include <ctype.h>
> #include <string.h>
>
> void dirfun(char *);
>
>
> int main()
> {
>
>         char *home="/home/navin/temp/";
>         dirfun(home);
>         return 0;
> }
>
>
> void dirfun(char *path)
> {
>         struct dirent *dir;
>         DIR *dp= opendir(path);
>
>         if(dp!=NULL)
>         {
>                 while((dir = readdir(dp)))
>                 {
>                         if(dir->d_type == DT_DIR)
>                         {
>                                 if(strcmp(dir->d_name,".") &&
> strcmp(dir->d_name,".."))
>
>                                      printf("%s\n",dir->d_name);
>
>
>
>                         }
>                         else
>
>                                 printf("%s\n",dir->d_name);
>
>
>
>
>                 }
>           }
>  }
>
>
>
> On Sun, Jun 3, 2012 at 8:14 AM, Ashish Goel <[email protected]> wrote:
>
>> ls-r implementation needed...
>>
>>
>> Best Regards
>> Ashish Goel
>> "Think positive and find fuel in failure"
>> +919985813081
>> +919966006652
>>
>> --
>> 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.
>>
>
>

-- 
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