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

Usage of Modelica.Utilities.Streams.readFile

Usage of Modelica.Utilities.Streams.readFile

Hi everyone,

i'm trying to read the file'WritebackData.txt and save it in file_content. I'm using this command:
String[:] file_content= Modelica.Utilities.Streams.readFile("C:\01_Data\Lukas\Hoehenverstellung\WriteBackData.txt");
When trying to simulate, nothing happens, no Simulation and no (error) message appears.
Can someone tell me how to use Modelica.Utilities.Streams.readFile properly

Thanks
lwinklmann

Re: Usage of Modelica.Utilities.Streams.readFile

You need to use \\ or / instead of \.

Re: Usage of Modelica.Utilities.Streams.readFile

Hi adrpo,

Thanks for your quick reply! Unfortunately, it still doesnt work. Can you think of any other error when using this command? Btw. it says when checking that my class has 0 equations and 1 variable.

Thanks
lwinklmann

Re: Usage of Modelica.Utilities.Streams.readFile

Can you post your full model? Otherwise is hard to guess what is wrong.
If the model is not public, you can send it to us at OpenModelica @ ida.liu.se and we will delete it after finding the issue.

Re: Usage of Modelica.Utilities.Streams.readFile

Sure! It was only a model for testing the Modelic.Utilities library. It only consists of that one command that i wrote before. My full model is:

model test2
String[:] file_content= Modelica.Utilities.Streams.readFile("C:/01_Data/Lukas/Hoehenverstellung/WriteBackData.txt");
end test2;

Also i double checked, the path i used is correct.

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