*.ini中如何删除的问题。
FileCopy.ini文件中内容:
[File]
Name=D:\work\安全培训.ppt
[FilePath]
path0=D:\新建文件夹
path1=D:\五笔安装
我想删除[FilePath]下的所有内容,如何处理?
[解决办法]
for i:=0 to n do
MyIniFile.DeleteKey(FilePath, 'path '+inttostr(i))
[解决办法]
删除健值:
DeleteKey(const Section, Ident: String);
删除一个分支:
EraseSection(const Section: String);
[解决办法]
既然要全删除,还需要分支个数干啥?直接用EraseSection(const Section: String)删掉就是了。
你不会真的想知道分支个数吧?
strs := TStringList.Create;
myini.ReadSection( 'FilePath ', strs);
count := strs.Count;//[FilePath]下的分支个数
strs.Free;