#include<stdio.h>
#include<dirent.h>
void main()
{
DIR *d;
struct dirent *dir;
d=opendir("."); //pointing to current directory
if(d)
{
while((dir=readdir(d))!=NULL)
{
printf("\n%s",dir->d_name);
}
closedir(d);
}
}
output
abc.txt
hello.txt
program1.c
newhello.txt
#include<dirent.h>
void main()
{
DIR *d;
struct dirent *dir;
d=opendir("."); //pointing to current directory
if(d)
{
while((dir=readdir(d))!=NULL)
{
printf("\n%s",dir->d_name);
}
closedir(d);
}
}
output
abc.txt
hello.txt
program1.c
newhello.txt
No comments:
Post a Comment