12-06-2012
11,
0
Join Date: Nov 2012
Last Activity: 10 December 2012, 11:46 AM EST
Posts: 11
Thanks Given: 11
Thanked 0 Times in 0 Posts
Opendir
code:
#include<iostream>
#include <dirent.h>
using namespace std;
int main()
{
DIR*dir;
dir = opendir("/");
if (dir !=NULL)
{
struct dirent * abcd;
while ((abcd=readdir (dir))!=NULL)
{
cout << abcd -> d_name;
}
}}
output : this gives the output of Directory "/"
ques :
what if i wanted to let user make an input of Directory name of there choice and if the directory name is not there program should show the contents of current directory and it should not show the hidden files in the directory.