954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

List files from a directory

Greetings:
That`s my question, until know i`ve been doing it by a batch file that i execute then read, is there a way to do it without the batch?, what i need is to list all of the Word (.doc) files of a given directory
Thanks in advance

ROGENATOR
Newbie Poster
17 posts since Sep 2005
Reputation Points: 11
Solved Threads: 0
 
Dave Sinkula
long time no c
Team Colleague
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
 

/*
Name: Praveen Kr.
email id: [email]prvnkmr449@gmail.com[/email]
mobile no.:08808130075
for any programming help u can contact on this id.
*/

int main()
{
DIR *dir;
struct dirent *ent;
dir = opendir ("c:\\tcpp\\");
if (dir != NULL) {

/* print all the files and directories within directory */
while ((ent = readdir (dir)) != NULL) {
printf ("%s\n", ent->d_name);
}
closedir (dir);
} else {
/* could not open directory */
perror ("");
return EXIT_FAILURE;
}
}

prvnkmr449
Junior Poster
106 posts since Sep 2010
Reputation Points: 3
Solved Threads: 16
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You