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".

BASENAME(file)

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

DIRNAME(file)

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

FILESIZE(file)

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

READWORD(file)

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

READSTEM(file,stem[,pool][,Upper])

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

WRITESTEM(file,stem[,pool])

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