Answered step by step
Verified Expert Solution
Question
1 Approved Answer
//filestat.c #include #include #include #include #include int main(int argc, char *argv[]) { mode_t file_perm; /* File permissions */ struct stat file_details; /* Detailed file info
//filestat.c
#include
#include
#include
#include
#include
int main(int argc, char *argv[])
{
mode_t file_perm; /* File permissions */
struct stat file_details; /* Detailed file info */
/* Retrieve the file details */
//write your code here
/* Get the file type */
//write your code here
/* Get the time of last access of the file */
//write your code here
/* Get the file permissions */
printf("File Permissions: ");
//write your code here
}
Overview Write a program that takes one file/directory name as command line input and reports the following information on the file: (a) File type (b) Time of last access (c) Read, write and execute permissions Requirements You will write a program (filestat) which will perform the following functions It will run from the command line as shown below: > filestat filename //This will display the following properties of filename: 1) File type, 2) Time of last access, 3) Read, write, and execute permissions for User, Group, and Others. > filestat directory //This will display the following properties of directory: 1) File type, 2) Time of last access, 3) Read, write, and execute permissions for User, Group, and Others.. Arguments: Expects one file name or directory name as argument. You may assume that the user will type the command correctly. Syntax: filestat
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started