M
mhk
Hi ,
i am writing a c language program in Unix to see the executable files in
a directory and it works if the directory is current but if i change to
another directory than current directory then it show all the files even
if not executable.
here is the main code
while (p = readdir(dp))
{
stat(p->d_name, &s);
if (strcmp( p->d_name,".")!= 0 && strcmp( p->d_name,"..")!= 0 )
{
if (s.st_mode & S_IXUSR)
{
cc = ctime(&s.st_mtime);
printf("%s| %s \n", p->d_name, cc);
}
}
}
can anyone help?
Thanks alot.
Jeff
i am writing a c language program in Unix to see the executable files in
a directory and it works if the directory is current but if i change to
another directory than current directory then it show all the files even
if not executable.
here is the main code
while (p = readdir(dp))
{
stat(p->d_name, &s);
if (strcmp( p->d_name,".")!= 0 && strcmp( p->d_name,"..")!= 0 )
{
if (s.st_mode & S_IXUSR)
{
cc = ctime(&s.st_mtime);
printf("%s| %s \n", p->d_name, cc);
}
}
}
can anyone help?
Thanks alot.
Jeff