Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Print to command prompt when echo is false

Print to command prompt when echo is false

Hi again,
I'm struggling finding a way to selectively print outputs to console while I'm running MOS scripts.
Either I leave echo(true), thus echoing any statement even if terminated by semicolon, or I completely block any output to console.

I tried printf and Modelica.Utilities.Streams.print, but none of them seem to allow writing to command prompt even though the latter does work for outputting to file.

Any idea is greatly appreciated!

Re: Print to command prompt when echo is false

The script echo.mos:

Code:


echo(false); getErrorString();
print("Some string\n"); getErrorString();
print("Some real:" + String(0.5)+"\n"); getErrorString();
print("Some integer:" + String(5)+"\n"); getErrorString();

The result

Code:


adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OMTesting
$ ~/dev/OpenModelica/build/bin/omc echo.mos
Some string
Some real:0.5
Some integer:5

Re: Print to command prompt when echo is false

Many thanks!
Really valuable information!

There are 0 guests and 0 other users also viewing this topic
You are here: