C Program for finding a file in the directory
#include <dirent.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dirent.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char
*argv[])
{
DIR *dp;
struct dirent *dirp;
char *process[10] =
{"neel", "peel", "feel"};
int i;
for (i=0; i< 3; i++)
{
if ((dp =
opendir("/home/cg/root")) == NULL)
{
printf("can't open %s", "/home/cg/root");
exit(1);
}
while ((dirp =
readdir(dp)) != NULL)
{
if(!strcmp(dirp->d_name, process[i]))
printf("\n%s", dirp->d_name);
}
printf("\n");
closedir(dp);
}