You can use the flush command. flush $fileId
As Elisha said you should *NEVER* hard code a path inside the Cloverleaf root. When you upgrade, the path is not valid for the new root. Hard coded paths are the most insiduous thing we encounter when migrating because the path will still be vaild until you remove the old root. Sometimes these hard coded paths can be hard to find.
If you use the env array as suggested you either have to declare it as a global as Elisha showed or use the whole path like $::env(HCISITEDIR), etc.
There are already existing globals for this purpose like $HciRoot, $HciSiteDir, etc. If use use either of those you have to follow the same rule as bove for the env array. You can see the list of Hci Globals with the Tcl command “info globals Hci*”.
Since this file is in your process directory and the engine always runs in the process directory you could also do something like:
set fileId [open [file join [pwd] TEMP_FILE_WITH_MRN.txt] a+ ]
Note the pwd command returns the currect directory which will be the process directory when the engine is running.
I usually prefer the file join command when building paths as it will always insert the correct path separators.
Lots of ways to do the same thing. Just a matter of preference 🙂