File_exists - hpgDesigns/hpgdesigns-dev.io GitHub Wiki

NOTOC {{-}}

Notation

Description

Checks if the given file exists.

Parameters

  • fname: The name of the file that is being checked.

Return Values

Returns 1 if it exists, 0 otherwise.

'''Note: '''You can be relatively sure of whether or not a file exists while using this. This function utilizes the Windows API to check for the file's existence, instead of trying to open it for reading. (If it had been programmed to test file existence using file reading, a simple permissions denial would cause the program to think the file didn't exist)

Example Call

if(file_exists('file.txt')) {
    show_message('We are alive!');
}