AIT_FileExists
Description
Checks whether the file with a specified attribute exists.
Format
integer AIT_FileExists (
string strFileName // Filename
[,integer nFileAttributes] // File attribute
);
Parameters
strFileName (input)
Specify the name of a file to be found.
nFileAttributes (input, optional)
Specify a file attribute, which must be one of the following values.
Value | Description |
---|---|
FILE_ATTRIBUTE_DIRECTORY | The file is a directory. |
FILE_ATTRIBUTE_HIDDEN | The file is a hidden one. |
FILE_ATTRIBUTE_SYSTEM | The file is part of the OS, or is OS-specific. |
FILE_ATTRIBUTE_ARCHIVE | The file is an archive one. The application uses this attribute as a mark for file backup or deletion. |
FILE_ATTRIBUTE_READONLY | The file is a read-only one. The application can read the file, but cannot program and delete it. |
By default, a file is detected independent of the file attribute.
Return values
The return value is 1 if the file exists, and 0 if not. If the function has not been executed successfully, the return value is -1. If -1 has been returned, you can use AIT_GetLastError to acquire an extended error code. The following gives the error codes that AIT_GetLastError might return:
Extended error number | Error code |
---|---|
2 | ERROR_FILE_NOT_FOUND |
3 | ERROR_PATH_NOT_FOUND |
5 | ERROR_ACCESS_DENIED |
6 | ERROR_INVALID_HANDLE |
8 | ERROR_NOT_ENOUGH_MEMORY |
14 | ERROR_OUTOFMEMORY |
15 | ERROR_INVALID_DRIVE |
21 | ERROR_NOT_READY |
53 | ERROR_BAD_NETPATH |
87 | ERROR_INVALID_PARAMETER |
112 | ERROR_DISK_FULL |
123 | ERROR_INVALID_NAME |
148 | ERROR_PATH_BUSY |
161 | ERROR_BAD_PATHNAME |
998 | ERROR_NOACCESS |
1005 | ERROR_UNRECOGNIZED_VOLUME |
1210 | ERROR_INVALID_COMPUTERNAME |
1214 | ERROR_INVALID_NETNAME |
1231 | ERROR_NETWORK_UNREACHABLE |