程序自身目录下有一ini文件是这样的
[myset]
progra1=d:\windows\system32\notepad.exe
progra2=d:\windows\system32\calc.exe
progra3=c:\link.exe
其中progra的个数是不确定的,也就是有可能只到progra2,也有可能直到progra6,现在要编程把progar(1-n)的所有值读入到rechedit1中,要如何实现呢??小弟愚昧,望大家帮帮忙,谢谢各位

解决方案 »

  1.   

    在配置文件的前面加progra的个数的量,如下:
    [myset]
    num=3
    progra1=d:\windows\system32\notepad.exe
    progra2=d:\windows\system32\calc.exe
    progra3=c:\link.exe
    ==============
    在写配置文件的时候把progra的个数num的值写上.
    然后在读的时候,先读num
    再然后
    var
    a:array[1..50] of string;
    for i:=1 to num do
     a[i]:=XXXXini.readstring('myset','progra'+IntToStr(i),'')
    总体思路就是这样
      

  2.   

    就是 mestars(米豆)(☆☆) 的做法了····
      

  3.   

    While (ini.ValueExists('myset', 'progra' + inttostr(i))) Do
    begin
          If i <> 1 Then
           rechedit1.Text := rechedit1.Text + (chr(13) + chr(10)) + ini.ReadString('myset', 'progra' + inttostr(i), '')
          Else
            rechedit1.Text := ini.ReadString('myset', 'progra' + inttostr(i), '');
          i := i + 1;
    end; 
    自己得出来的:)