#include #include #include #include #include int main() { DIR * d = opendir("."); while (1) { struct stat s; struct dirent * e = readdir(d); if (e == NULL) break; printf("found file %s\n", e->d_name); stat(e->d_name, & s); struct passwd * pwe = getpwuid(s.st_uid); printf("owner %s\n", pwe->pw_name); printf("size %ld bytes\n", s.st_size); printf("mode %o\n", s.st_mode); printf("mtime %s", ctime(& s.st_mtime)); } printf("end of directory\n"); closedir(d); }