STRFILE

Purpose:

Reads and converts a plain text file into a string with embedded newlines.

Syntax:

STRFILE("filename", reverse, nobrace)

"filename"

-

Optional. A Window, defaults to the current Window.

reverse

-

Optional. An integer, the reverse read file flag:

0:

Read file from the beginning (default)

1:

Read file from the end

nobrace

-

Optional. An integer, disable expand expressions in braces, {}:

0:

Expand expressions in braces (default)

1:

Do not expand expressions in braces

Returns:

A string.

Example:

Consider the file "max.txt" with the following contents:

 

The maximum is {max} and the minimum is {min}.

 

W1: 1..100;label(strfile("max.txt"))

 

labels W1 with the text "The maximum is 100.000000 and the minimum is 1.000000." The {max} and {min} fields in the file are automatically evaluated.

Example:

strfile("symbols.txt", 1, 1)

 

returns the contents of the file symbols.txt as a single string with embedded newlines, and the lines of the file in reverse order. Expressions in braces are not interpreted.

Remarks:

STRFILE is useful with annotation functions such as TEXT for placing the contents of text files in Windows. For example:

 

{0, 1, 2};text(1, 1, strfile("ascii.txt"))

 

Set nobrace to 1 to suppress the expansion of expressions in {}.

See Also:

STRCAT

STRLIST

TEXT