Function: File_Exists

Check if a file with a given path exists in the file system. To avoid errors, one can check if a file exists before trying to open it, for example.

Prototype:


bool z = file_exists ( "/path/to/file.txt"); 

Parameters:

Parameter name Type Description
path string full path or relative path to the actual file

Return value: Type Boolean: True if the file exists, otherwise false.

Example:


if ( file_exists ( "datafile.txt")) then
    // read the datafile
else
    // Create the datafile
end if

See also: