Previous Top Index Next

External File Functions (DOS+UNIX)

The following routines are available after loading the library file files.r with the command: CALL import "files.r".


Returns the filename stripped from the directory path
SAY filesize("/tmp/test.dat") /* test.dat */


Strips the non directory suffix from file name
SAY filesize("/tmp/test.dat") /* /tmp */


Returns the size of file in bytes. The file must not be opened.
SAY filesize("test.dat")


Read one word from file file
SAY readword("test.dat")


Read the entire file into stem using as default pool 0. The stem.0 contains the number of lines read.
CALL readstem "test.dat","file."
CALL readstem "test.dat","file.",1


Write the stem from pool pool into the file file. The stem.0 contains the number of lines to write.
CALL writestem "test.dat","file."
CALL writestem "test.dat","file.",1

EXIST(file), STATE(file)

Returns '1' if file exists, else '0'.
SAY exist("test.dat")

Previous Top Index Next