(1) 文件目录的搜索方法和算法是什么?
    递归算吗?如果算,那它的算法是什么呢?
    请详细解释一下,我现在不是太懂,但急需解决这个问题,请各位大侠帮帮我  的忙谢谢了。(2) 文件目录中的“.”和“..”是什么意思???

解决方案 »

  1.   

    1 算递归的,而且是挺典型的递归
     
    procedure searchfile(dir:string; subdir:boolean);//dir是要搜的目录,substring是判
                                                     //断是不是要搜寻子目录
    var rec:TSearchRec;
        found:integer;
    begin
      if dir[length(dir)]<>'\' then dir:=dir+'\';
      found:=findfirst(dir+'*.*',faAnyFile,rec);
      while found=0 do
      begin
        if (rec.Attr and faDirectory > 0) and (rec.Name[1]<>'.')and (subdir=true)   
        then
          searchfile(dir+rec.Name,true);
        
        //do somethinghere
        found=findnext(rec);
      end;
    end;
      

  2.   

    goodloop(小志),你好!
    你给的dir[length(dir)]是什么意思?