那位任兄知道怎样判断某个INI文件的指定目录是否存在?
是使用tinifile.sectionexits(filenamedir)?

解决方案 »

  1.   

    uses
     FileCtrl;procedure TForm1.Button1Click(Sender:TObject);
    begin
     if DirectoryExists('c:\windows') then
     begin
      ShowMessage('目录已存在');
     end;
    end;
      

  2.   

    哦,SORRY,是指定目录下的文件是否存在?
      

  3.   

    myinifile.readsections(TStrings变量);
     可将INI文件中所有小节名读取至一个字符串列表变量中去。
    //到里面去查就知道在不在了,例如想知道里面有没有aa这个小节名:
    var
     SectionList: TStrings;
    begin
     SectionList:=TStringList.Create;
     try
      MyIniFile.ReadSections(SectionList); //读取所有小节名
      if SectionList.IndexOf('aa')<0 then Showmessage('没有')
      else Showmessage('有');
     finally
      SectionList.Free;
     end; //end of try
    end;
     myinifile.readsection('小节名', TStrings变量);
    可将指定小节中的所有关键字名读取至一个字符串列表变量中;myinifile.readsectionvalues('小节名', TStrings变量);
    可将INI文件中指定小节的所有行(包括关键字、 = 、值)读取至一个
    字符串列表变量中去。