Question: This function should return 1 if a file named filename exists in the filesystem, otherwise, if there is no file with that name (or if
This function should return 1 if a file named filename exists in the filesystem, otherwise, if there is no file with that name (or if filename is NULL), it should return 0. In order to test whether a file exists you could just try to open it for reading and see if that operation failed, but in UNIX there is a better way. The system call stat) returns information about a file; its prototype is int stat(const char *path, struct stat *buf).
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
