I am trying to solve an exercise for my university. In this matter, how can I print the index of a directory with the type of each file, and the date of the last modified file, if the input is the name of the directory?
I was trying to use something like that (dir->d_name & R_OK) but I cant cause expression must have integral type
#include <stdio.h>
#include <dirent.h>
void properties(struct stat file);
int main()
{
DIR *d;
struct dirent *dir;
char location[500]
printf("Write the file location: \n");
scanf("%s", location);
d = opendir(location);
//Emfanisi index tou directory
if (d != NULL)
{
while ((dir = readdir(d)) != NULL)
{
printf("%s\n", dir->d_name);
printf("\nType: ");
if (dir->d_name & R_OK)
}
closedir(d);
}
}