please i need help

I want to Browses for all files ,folder and sub folder in hard disks
#include <errno.h>
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
DIR *pdir;
struct dirent *pent;

pdir=opendir("c:\\");
if (!pdir){
printf ("opendir() failure; terminating");
exit(1);
}
errno=0;
while ((pent=readdir(pdir))){
printf("%s", pent->d_name);
}
if (errno){
printf ("readdir() failure; terminating");
exit(1);
}
closedir(pdir);
}
I want to output folder and files inside folder
Topic archived. No new replies allowed.