next up previous
Next: GRAPH draws graphics during Up: INSTRUCTIONS Previous: EXTR extracts a message

FILE writes values in a text file

Syntax:

     FILE(<file name>, <list of expression /format/ >);
It is used to write a line of data in a text file. The user may also use the instructions of the Pascal language to write files. FILE instruction relieves the user from declare, assign, open, and close the files.

<file name> is a valid name of file. If the file exists, it is overwritten by the new data. If it does not, then it is created and opened at the beginning of the simulation and closed at the end of the simulation.

<list of expression /format/ > is a list of expressions as the lists in WRITE or WRITELN in Pascal. Expressions must not be broken in different lines.

Generated text files have the following structure:

The system introduces an extra blank space between contiguous values. If many FILE instructions write in the same file, the order of the lines in the file is the order of the executions.

If the file is to be used with the Graphic option, the list would consist of simple real variables without format.

This instruction can be used in any type of node.

Example:

   Aa ::  FOR I := 1 TO 3 DO
          FILE(Arxm, I + Azz: 8: 2, Ch1, I: 2, B[I]: 5: 1, Azz);

   INIT ACT(Aa, 0);
        Azz := 99; Ch1 := 'J'; ASSI B[1..3] := (19, 20, 21);
The file Arxm, if written only for one execution of node Aa, will contain:
   I + Azz
   Ch1
   I
   B[I]
   Azz
   \#
   100.00 J  1  19.0  9.9000000000E+01
   101.00 J  2  20.0  9.9000000000E+01
   102.00 J  3  21.0  9.9000000000E+01
See example 5 (GLIDER examples book) for a file to be used with the Graphic option.


next up previous
Next: GRAPH draws graphics during Up: INSTRUCTIONS Previous: EXTR extracts a message

domingo c
Mon Mar 20 17:36:19 PST 2000