Print string to terminal or file |
This information is part of the Modelica Standard Library maintained by the Modelica Association.
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()'
string |
Default Value: "" Type: String Description: String to be printed |
---|---|
fileName |
Default Value: "" Type: String Description: File where to print (empty string is the terminal) |