Http://blog.chinaunix.net/uid-22785134-id-360282.html
int access (const char *filename, int amode);
A amode parameter of 0 indicates the existence of the check file, if the file exists, returns 0, does not exist, returns-1.
This function can also check other file attributes:
06 Checking Read and Write permissions
04 Checking Read Permissions
02 Checking Write permissions
01 Checking Execution Permissions
00 checking the existence of files
And this even if the file does not have Read permission, you can also determine whether the file exists in the
There is a return of 0, there is no return-1
C function
Name of function: Access
Function: Determine access rights to a file
Usage: int access (const char *filename, int amode);
#include <stdio.h>#include<io.h>intFile_exists (Char*filename); intMainvoid) {printf ("Does notexist.fil exist:%s\n", File_exists ("Notexists.fil") ?"YES":"NO"); return 0; } intFile_exists (Char*filename) { return(Access (filename,0) ==0); }