Currently, I have a program that lists the contents of a directory. What I need to do (as I've sort of started) is to use the stat structure to print such things as date modified, etc. like the "ls" program does. My code is as follows:
Basically, what I'm wondering is how I can use the stat structure to print such information. Can anyone help me out or at least point me in the right direction? (And the man pages are not much help for me).
struct dirent **namelist;
struct stat buf;
int n = scandir("./", &namelist, 0, alphasort);
for ( i = 0; i < n; i++ )
char *file_name = namelist[i]->d_name;
If someone could just touch up my code so that it would print the date modified or something, so I could follow by example, that would be great.