Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<dirent.h>
- #include<stdio.h>
- #include<sys/types.h>
- #include<sys/stat.h>
- int main()
- {
- DIR *d;
- struct dirent *dir;
- struct stat statbuf;
- //d=opendir("../../../../");
- d=opendir(".");
- if(d)
- {
- while((dir=readdir(d))!=NULL)
- {
- //if(statbuf.st_mode & S_IFDIR !=0)
- if(S_ISDIR(statbuf.st_mode)) /*Checking condition */
- {
- printf("Vivek\n");
- printf("%s\n",dir->d_name);
- }
- if(S_ISREG(statbuf.st_mode))
- {
- printf("%s\n",dir->d_name);
- }
- printf("%s\n",dir->d_name); /*simple all files displays */
- }
- closedir(d);
- }
- return 0;
- }
- @C -Programs to find a list of subdirectories in current directory @
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement