如何读、写ini文件?想实现以下功能:
ini文件格式如下
[place]
m1=yt
m2=gh
m3=gt其中m1、m2、m3中的1、2、3能够在程序中自动生成,当需要在m3后再添加时,能够自动生成m4

解决方案 »

  1.   

    1 用 TIniFile
    2 加一个count,容易处理一些[place]
    count=4
    m1=yt
    m2=gh
    m3=gt
    m4=abc
      

  2.   

    我的delphi6怎么不能识别Tinifile类型?提示是为申明的类?
      

  3.   

    uses 
    inifiles
    procedure IniWrite;
    var
    ini:tinifile;
    begin
    ini:=tinifile.create(getcurrentdir()+'\test.ini');
    ini.writestring('place','m1','yt');
    ini.writestring('place','m2','gh');
    ini.writestring('place','m3','gt');
    ini.destroy;
    end;procedure iniread;
    var
    ini:tinifile;
    s1,s2,s3:string;
    begin
    ini:=tinifile.create(getcurrentdir()+'\test.ini');
    s1:=ini.readstring('place','m1','yt');
    s2:=ini.readstring('place','m2','gh');
    s3:=ini.readstring('place','m3','gt');
    ini.destroy;
    end;procedure addm4;
    var
    ini:tinifile;
    begin
    ini:=tinifile.create(getcurrentdir()+'\test.ini');
    ini.writestring('place','m4','yt');
    ini.destroy;
    end;