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
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
Get step-by-step solutions from verified subject matter experts
