Opened 10 years ago

Closed 10 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!

Change History (1)

comment:1 by Martin Sjölund, 10 years ago

Resolution: wontfix
Status: newclosed

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...

Note: See TracTickets for help on using tickets.