#include #include #include "dirent.h" #include #pragma warning( disable:4996) void processDir( const char *dirName ) { DIR *dp = opendir( dirName ); struct dirent *slot = NULL; /* Read each entry */ for( slot = readdir( dp ); slot != NULL; slot = readdir( dp ) ) { struct stat buf; if( stat( slot->d_name, &buf ) == -1 ) { printf( "Error stating file %s\n", slot->d_name ); continue; } printf( "%12s ", slot->d_name ); printf( "%8d ", buf.st_size ); printf( "%11o ", buf.st_mode ); printf( "%d" , buf.st_mtime ); printf( "\n" ); } closedir( dp ); } int main( ) { processDir( "." ); return 0; }