Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1556 |
|
There are two functions which allow the status of a file to be checked. is_asciifile() returns true if the file argument is an ASCII file:
is_asciifile('/etc/passwd')should return T because
/etc/passwd
is an ASCII file,
is_asciifile('/bin/cat')should return F since
/bin/cat
is a binary executable. The optional
second parameter to is_asciifile()
specifies how many character should
be checked in the file before concluding that the file is indeed ASCII. So:
is_asciifile('/bin/cat',4)might return T because executables often have an ASCII identifier as their first few characters, and this example only checks the first four characters.
The stat function returns general information about a given file. This example:
stat('/var')would return a record containing most of the important information about the file. At some point, the result of stat will be expanded to provide information about the contents of directories and information to follow symbolic links. stat has two extra optional the first is the number of bytes to check to differentiate ASCII files from other files. The second parameter is a boolean value, false by default, which indicates if symbolic links should be followed.