Question: in c programing, how would i use open() and stat() to open a file, append to it but ensure the orginal last accesed time and

in c programing, how would i use open() and stat() to open a file, append to it but ensure the orginal last accesed time and modification time are restored to the origninal time it was created in c programing, how would i use open() and stat() to open

Open the regular file passed in via the command line argument and append at least one printable, non-whitespace character to the file. After you have appended data to the file, ensure the original last access time and last modified times are restored to at least the second. You may assume the command line argument is either in the current working directory, or is not in the file system (there is no path section to the command line argument). If the command line argument does not exist, exit the program returning a unique error number. Do not assume the command line argument is a regular file. You may assume that if the command line argument is a regular file the file will be an ASCII text file. If the command line argument is not a regular file, output a simple error message and exit the program returning a unique error number. Open the regular file passed in via the command line argument and append at least one printable, non-whitespace character to the file. After you have appended data to the file, ensure the original last access time and last modified times are restored to at least the second. You may assume the command line argument is either in the current working directory, or is not in the file system (there is no path section to the command line argument). If the command line argument does not exist, exit the program returning a unique error number. Do not assume the command line argument is a regular file. You may assume that if the command line argument is a regular file the file will be an ASCII text file. If the command line argument is not a regular file, output a simple error message and exit the program returning a unique error number

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!