- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » special characters
special characters
special characters
Hi,
I need to pass a string to a external c-function under windows. The string contains special characters like \n for a new line. If I Write the characetr to a text file, the two characters \n appear in the text file (and not the expected new line).
My questions:
How does OpenModelica treat special characters like \n?
Which string would give me the new line?
Frank
Re: special characters
It depends what version of OMC you are using. Older versions of OMC would output \\n in some cases and \n in others (a bit arbitrarily).
As far as I know, putting a newline character in the Modelica string, i.e.
Code:
String str = "ab
c";
works for all OMC versions. If you found a certain way (read:bug) in which OMC 1.7 does not translate \n, post it and it will be fixed.
- sjoelund.se
- 1700 Posts
Re: special characters
Oh yea... The code I tested was:
Code:
model M
function fn
input String str;
output Integer i;
external "C" i=puts(str);
end fn;
Real x;
equation
x = fn(String(time) + " ab\nc");
end M;
- sjoelund.se
- 1700 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » special characters