Read file content as a single word

readfile name

Reads in and returns content of a file with the specified name. The result is a single word even if the file contains multiple lines and whitespaces.

If the name does not contain an absolute path then the file is assumed to be in the current directory, specified with the :pool_cfg,"current_dir variable.

The name can be also a http adress.

Example:

"l := [1.23 abc [a b c]]
writedata :l "test.txt

print "|file content as a list:|
print readlist "test.txt
print "|file content as a word:|
print readfile "test.txt

Output:

file content as a list:
[[1.23] [abc] [a b c]]
file content as a word:
1.23
abc
a b c

See also:

readlist - read list from a file
writedata - write data to a file

Table of Content