Streams.print(string); Streams.print(string,fileName);
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.
Streams.print("x = " + String(x)); Streams.print("y = " + String(y)); Streams.print("x = " + String(y), "mytestfile.txt");
Streams, Streams.error, ModelicaReference.Operators.'String()'
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;