File Functions


FILE_ISEXISTED

Returns TRUE if the file or folder does exist.

string FILE_ISEXISTED( filename )

FILE_DATE

Gets the date of a file.

datetime FILE_DATE( filename[, type] )

The parameter type can be one of the following:

  • 0 -- Create date and time
  • 1 -- Last write date and time
  • 2 -- Last access date and time

FILE_SIZE

Gets the size of a file.

number FILE_SIZE( filename )

FILE_PATH

Gets the path from a full path filename.

string FILE_PATH( filename )

FILE_PATH( @"c:\\document\\abc.log") //return then extension "c:\\document\\"

FILE_NAME

Gets the name from a full path filename.

string FILE_NAME( filename )

FILE_NAME( @"c:\\abc.log") //return then extension "abc.log"

FILE_EXT

Gets the extension name within a full path filename.

string FILE_EXT( filename )

FILE_EXT( @"c:\\abc.log") //return then extension "log"

FILE_TEMPNAME

Returns a name for a temporary file.

string FILE_TEMPNAME( [prefix_string],[bool_contain_path] )

Note: The function uses up to the first three characters of this string as the prefix of the file name. The default value of the optional parameter bool_contain_path is FALSE.

  • FILE_TEMPNAME() //23123.tmp
  • FILE_TEMPNAME( "abc" ) //abc3123.tmp
  • FILE_TEMPNAME( "abc", true ) //c:\users\john\appdata\local\temp\abc3123.tmp

FILE_PICK

Retrieves a filename from a folder.

string FILE_PICK(Filename(wildchar is allowed)[, is_folder_allowed][, index] )

The parameter index is zero-based.

  • FILE_PICK( 'c:\\*.jpg', FALSE, 2 ) //Returns the name of the third JPG file.
  • FILE_PICK( "c:\\abc.jpg" ) //Returns the abc.jpg if the file is existed, otherwise, returns an empty string.

IMG_RES

Gets the width or height of an image file.

IMG_RES( filename [, what] )

The parameter what can be one of the follow:

  • 0 (Default value) -- Retrieves a string to represent the size in the format width x height. For example: 100x200
  • 1 -- Retrieves the number value of the width of the image.
  • 2 -- Retrieves the number value of the height of the image.

IMG_RES( @"c:\\abc.jpg") //return a string "100x200"
IMG_RES( @"c:\\abc.jpg", 1) //return the number 100

IMG_LOAD

Loads an image file.

binary IMG_LOAD( filename )

IMG_LOAD( @"c:\\a.jpg") //load the image file a.jpg