You should be able to run your program from the command line by using
assign1 size dir1 dir2 dir3 ...If there are no directories specified, use ".". Use recursion to get to the subdirectories.
You will need to grab dirent.h if you are working on some Windows systems.
DIR *opendir( char *dirname ); // dirent.h struct dirent *readdir( DIR *dp ); // dirent.h void closedir( DIR *dp ); // dirent.h sprintf( char [], const char *, ... ); // stdio.h int stat( char *, struct stat * fp ); // stat.h // return code is non-zero if failure S_IFMT and S_IFDIR for mask and directory patternHere are the structs:
typedef struct dirent { char d_name[NAME_MAX + 1]; ... } dirent; typedef struct DIR { char *dirname; /* directory being scanned */ dirent current; /* current entry */ int dirent_filled; /* is current un-processed? */ } DIR; struct stat { _dev_t st_dev; _ino_t st_ino; unsigned short st_mode; short st_nlink; short st_uid; short st_gid; _dev_t st_rdev; _off_t st_size; time_t st_atime; time_t st_mtime; time_t st_ctime; };