这是一个奇怪的现象。我有一个Delphi10.3应用程序,它已经开始向TIniFile写入重复的条目。
代码如下:
with TIniFile.Create(UserDatFileName) do
try
WriteInteger(SFormName, 'Top', AForm.Top);
WriteInteger(SFormName, 'Left', AForm.Left);
WriteInteger(SFormName, 'Height', AForm.Height);
WriteInteger(SFormName, 'Width', AForm.Width);
WriteString(SFormName, 'WindowState', SWindowState);
finally
Free;
end;多年来,这一直运行得很好。现在,突然之间,我得到了这样的输出:
[fMainForm]
Top=0
Left=0
Height=556
Width=671
WindowState=wsMaximized
pnlNavigation.Width=165
TreeListcxTreeListModule.Width=161
Top=0
Left=0
Height=556
Width=671
WindowState=wsMaximized
pnlNavigation.Width=165
TreeListcxTreeListModule.Width=161
Top=0
Left=0
Height=556
Width=671
WindowState=wsMaximized
pnlNavigation.Width=165
TreeListcxTreeListModule.Width=161
... etcetera etcetera对于为什么会发生这种情况,有什么建议吗?我以为TIniFile值对在每个部分中都应该是唯一的?
发布于 2020-12-30 03:07:49
@dummzeuch代表胜利:在文件的开头有三个无关的字符(十六进制,EF,BB,BF)。移除这些解决方案解决了问题。我还在另一个类似问题的INI文件的开头找到了同样的三个字符。
https://stackoverflow.com/questions/65485019
复制相似问题