The StreamFile box represents the file to read or write during the File-Box process. It is attached to the file via its pathname.
It has one input and one output :
|
The properties of the StreamFile can be edited if needed.
To open the StreamFIle properties
window, double click on the box.
Read / Write
, Write
, Read
. File Type
pop up menu offers two file formats : text or SDIF. The File Exists
pop up menu offers four options, which apply to the targeted file if it exists. Each of the different options determine the way the program behaves when the text file is open or created to access its contents and the choice of a
destructive or non destructive
action.
The file-write function writes something in the file. It has two inputs and one output:
|
The file-write-line function is similar to file-write, but adds a line return at the end of the input data.
To write several lines, an iterative process must be introduced in the program. Most of the time, each iteration triggers one operation in the File-Box loop.
The file-read-line function allows to read one line in a file. It has one input and one output :
When all the lines of the text are exhausted, file-read-line returns "nil". |
Most of the time, each iteration triggers one operation. In this case, the successive lines can be stored with an accumulator such as collect, as in an OMLoop.
"Eof" stands for "end of file", "p" for "predicate". The file-eof-p function is a predicate, which tests if a streamfile is at the end of the file. It has one input and one output :
It can be associated with whileloop and OMIF, which execute a specific operation when the end of the file has been reached. Hence, this function allows to read a file whose number of lines is unknown. |