Check Access Permissions (continued.) /* all directories in the path exist and are executable. */ /* now check existance and read access to the file itself. */ if (access(file_path, F_OK) == -1) { sprintf(err_msg, "File does not exist."); return 0; } if (access(file_path, R_OK) == -1) { sprintf(err_msg, "no read access to file."); return 0; } /* all tests passed. */ return 1; }