读书人

delphi inifile,该怎么处理

发布时间: 2012-03-30 17:32:09 作者: rapoo

delphi inifile

Delphi(Pascal) code
delphi inifile的 readsection 和 readsectionvalues 的用法
请举个简单易懂的小实例说明 谢谢!

[解决办法]
看帮助了,帮助里面有例子的
Delphi(Pascal) code
The following example reads information from a file into three listboxes on a form.uses IniFiles;procedure TForm1.FormActivate(Sender: TObject);var  AppIni: TIniFile;begin  AppIni := TIniFile.Create('win.ini');  AppIni.ReadSections(ListBox1.Items);  AppIni.ReadSection('Ports',Listbox2.Items);  AppIni.ReadSectionValues('Ports',ListBox3.Items);  AppIni.Free;end;
[解决办法]
探讨

看帮助了,帮助里面有例子的
Delphi(Pascal) code

The following example reads information from a file into three listboxes on a form.

uses IniFiles;
procedure TForm1.FormActivate(Sender: TObject);

var
AppIni:……

[解决办法]
http://blog.csdn.net/bdmh/article/details/4147104
[解决办法]
更高级的理解是看源码,我解释通俗点,比如ini文件格式是:

[K1]
A=123
B=234
[K2]
C=xxx
D=yyy

procedure ReadSections(Strings: TStrings);
取出K1,K2添加到Strings中

procedure ReadSection (const Section: String; Strings: TStrings);
取出Section项中的Key值添加到Strings中,比如Section=K2,则Strings结果是C,D

procedure ReadSectionValues(const Section: String; Strings: TStrings);
取出Section项中的Key+Value值添加到Strings中,比如Section=K1,则Strings结果是A=123,B=234
[解决办法]
探讨
http://blog.csdn.net/bdmh/article/details/4147104

读书人网 >.NET

热点推荐