Write a C program that takes a directory name as input and gives information about the named files in the directory.
For every file in the directory, print the following information.
- File name
- inode number
- number of links
- User ID of owner
- Group ID of owner
- Size in bytes
- Last access
- Last modification
- Last status change
- Number of disk blocks allocated
- Access mode in octal
- Access mode flags
- Refer to the sample output sample_output.txt as an example of file stats for the directory games.
- Usage:
./filestats directory_name - Linux timestamps hold a number rather than a date and time. When Linux needs to display a timestamp, it translates this number into a date and time. You can use the call
ctime(t)to convert the calendar timetinto a null-terminated string of the formWed Jun 30 21:49:08 1993\n. - Your program will be manually tested for correctness with additional test cases including different file types.
- Your program should compile with no errors and warnings.