10.06.2016 Views

eldo_user

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Eldo Control Language<br />

Library of Functions for Tasks<br />

fopen<br />

Task function category: Functions Operating on Files<br />

Returns a file variable if the file whose path is FILE_PATH has been successfully opened;<br />

otherwise, the program exits printing the optional message DIE_MESSAGE.<br />

Usage<br />

fopen(FILE_PATH, MODE [, DIE_MESSAGE])<br />

Arguments<br />

• FILE_PATH<br />

Path to file.<br />

• MODE<br />

MODE selects the open mode: "w" for write, "r" for read, or "a" for append (note that it is a<br />

string). The file must already exist to be opened in read mode. In write mode, it will be<br />

created if it does not exist, or overwritten if it already existed. In append mode, if the file<br />

already exists it will be appended to.<br />

• DIE_MESSAGE<br />

Optional. Function exit message text.<br />

Examples<br />

If you want to append the same file multiple times during the execution of many tasks, instead<br />

of using multiple fopen/fclose functions it is more efficient to keep the file always open and to<br />

pass the file variable as a task parameter. To do so, it is necessary to define a main task that will<br />

open the file and then call the subtasks with the file variable as a parameter, for example:<br />

Eldo® User's Manual, 15.3 903

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!