Archive: File Read & Write


File Read & Write
Hello,

I have development an installer with custom files. users responses are stored in the $PLUGINSDIR\FileName.ini.

As one of the requirements, I need to write out a general user respone file (ie:\ for silent installs, for configurator components, etc ... ).

I do this, and it works fine until the temporary file of $PLUGINSDIR\FileName.ini has been modified with WriteINIStr.

So, I can open the response

FileOpen $FileHandle "$INSTDIR\ResponseFile.xml" w
FileWrite $FileHandle "Response Value"
...
FileClose $FileHandle

but as soon as I try to read the value from the updated '$PLUGINSDIR\FileName.ini' with
ReadINIStr $TEMP_VAR $PLUGINSDIR\FileName.ini "Field 4" ListItems

The installer throws a file create error for $INSTDIR\ResponseFile.xml. If I do not update the screen references by '$ScreenFile', then no problem..

Any idea how I can do this ?


I found that the WriteINIStr is the culprit. I suppose of leaves the file open (marked dirty) ?

How can I close the file ? or what do I need to do ?


I found that the WriteINIStr is the culprit. I suppose of leaves the file open (marked dirty) ?
Maybe attaching your script used would be better to clarify this. Maybe the .xml file has been opened first with another FileOpen, or you're running it somewhere? Maybe you're using FileOpen with WriteINIStr, and thus the error? Or maybe you didn't use FlushINI (Win9x) to update the INI file and thus, you read it without success? I don't know.

I though about including the script, but it is getting rather lengthy. I did use FlushINI command... same error.

The workaround is to store it in a variable...