Opened 11 years ago
Closed 11 years ago
#2753 closed defect (wontfix)
Modelica.Utilities.Streams.close not working properly (blocked by omc.exe)
| Reported by: | Jan Kokert | Owned by: | somebody |
|---|---|---|---|
| Priority: | high | Milestone: | 1.9.1 |
| Component: | *unknown* | Version: | trunk |
| Keywords: | close file Streams external C | Cc: |
Description
When I use the Modelica.Utilities.Streams.close(<file>) to close the file after I read some data, I still don't have access to the file (modify, rename ect.)
Try the following minimal working example! omc.exe will still block the file after simulation:
model FileStreamTest
import Modelica.Utilities.*;
String line;
Boolean endOfFile;
algorithm
// open file and read data
(line, endOfFile) := Streams.readLine("D:/text.txt", 1);
// close file (NOT working)
Streams.close("D:/text.txt");
end FileStreamTest;
It seems, that
external "C" ModelicaStreams_closeFile(fileName);
is not working correctly.
A bugfix is important to run Modelica.Utilities.Examples.readRealParameterModel several times with different file content.
By the way: In the function readRealParameter the close command is missing at all, so I modified the
"lib\omlibrary\Modelica 3.2.1\Utilities\Examples.mo".
It would help me al lot, if the file closing is working to finally realize a parametric simulation.
Thanks in advance!

Use m:newticket. It's a Windows-specific problem that is also related to MSL. Too bad they do not use external objects for File pointers...