Social Icons

Wednesday, 1 May 2013

Reading Files Of a Directory


#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<dirent.h>
struct dirent *p;
int main()
{
DIR *q;
int  m;
q=opendir("1");
if(q==NULL)
{
printf("\n Error Occured : ");

}

else
{
printf("\n  File Name  |||||||     Inode No.\n");
printf("......................................");
while(p=readdir(q))
{

printf("\n %s",p->d_name);
m=p->d_ino;
printf("\t\t\t %d",m);
}
}
closedir(q);
return 0;
}


No comments:

Post a Comment

 

Sample Text

Sample text

 
Just Programming Cse DriveReputation Management