[Lazarus] Unable to rewrite .ini file which exists... error unable to create .ini file. (need to rewrite it).

zeljko zeljko at holobit.net
Tue Mar 15 08:09:17 CET 2011


On Tuesday 15 of March 2011 05:25:41 Peter Williams wrote:
> Hi All,
> I use this procedure to save an inifile using the standard IniFiles unit.
> The problem I have is that when an .ini file already exists I cannot
> overwrite it. I need the TextFiles equivalent of Rewrite() for Inifiles.
> This line:  ConfigIni :=
> TIniFile.Create(ChangeFileExt(Application.ExeName, '.ini'));... when the
> ini file exists fails with an error message of 'unable to create
> appname.ini'. This is because it cannot create an ini file which already
> exists. How then do I rewrite the .ini file?

I've seen such problem with fpc-2.4.3 under win7 64bit only.
My workaround is to use TMemIniFile instead of TIniFile. So try that first.

zeljko




More information about the Lazarus mailing list