.Modelica.Utilities.Streams.print

Information

Syntax

Streams.print(string);
Streams.print(string,fileName);

Description

Function print(..) opens automatically the given file, if it is not yet open. If the file does not exist, it is created. If the file does exist, the given string is appended to the file. If this is not desired, call "Files.remove(fileName)" before calling print ("remove(..)" is silent, if the file does not exist). The Modelica environment may close the file whenever appropriate. This can be enforced by calling Streams.close(fileName). After every call of "print(..)" a "new line" is printed automatically.

Example

  Streams.print("x = " + String(x));
  Streams.print("y = " + String(y));
  Streams.print("x = " + String(y), "mytestfile.txt");

See also

Streams, Streams.error, ModelicaReference.Operators.'String()'

Interface

function print
  extends Modelica.Icons.Function;
  input String string = "" "String to be printed";
  input String fileName = "" "File where to print (empty string is the terminal)" annotation(
    Dialog(saveSelector(filter = "Text files (*.txt)", caption = "Text file to store the output of print(..)")));
end print;

Generated at 2020-06-05T07:38:22Z by OpenModelica 1.16.0~dev-420-gc007a39