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 />

Statement Overview<br />

.define_task hello_world_2<br />

set myfile = NULL<br />

myfile = fopen ("./hello.txt", "w", \<br />

"cannot open hello.txt for writing")<br />

fprint (myfile, "Hello world.\n")<br />

fclose (myfile)<br />

.end_define_task<br />

See “Task Definition” on page 814 and “Variables” on page 821 for more information on the<br />

concepts used in the example.<br />

File type variables are used by the fopen, fprint and fclose commands. The fopen command in<br />

the example above attempts to open the file hello.txt for writing. If this is successful, the logical<br />

name myfile can be used in further commands to reference the file. If for some reason this is not<br />

possible (for example the disk full, access is denied, and so on) the die optional message is<br />

printed to the standard output, and the program aborts. If the file can be opened, then the myfile<br />

name becomes non-NULL, and it can be used in subsequent fprint commands to designate this<br />

particular file. To close the file, the fclose command must be used. The myfile variable is then<br />

automatically set to NULL, and any further attempt to use it in an fprint command will result in<br />

an error.<br />

The stdout logical name can be used to write to the standard output of the calling process<br />

(usually the console). Standard error (stderr) is not supported.<br />

See Library of Functions for Tasks for the complete list of functions operating on file type<br />

variables.<br />

Related Topics<br />

Variables<br />

Library of Functions for Tasks<br />

Predefined Constants<br />

A number of physical constants are available. This is a list of reserved symbols, such as pi,<br />

boltz, and so on. Using these symbols for any purpose (a variable or task for example) is<br />

forbidden.<br />

• epso = 8.854214871×10 −12<br />

• boltz = 1.3806226×10 −23<br />

• charge = 1.6021918×10 −19<br />

• pi = 3.141592654<br />

• twopi = 6.283185308<br />

834<br />

Eldo® User's Manual, 15.3

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

Saved successfully!

Ooh no, something went wrong!