用户在edit1中输入:c:\aa\bb\cc\efg(由用户输入任意的路径,可能存在,可能不存在)
button1实现创建这些目录的功能,我用createdirectory和creatdir试过了,不能实现
所有可能的情况,求救具体例子,————————新手上路,多加指点

解决方案 »

  1.   

    createdirectory是布你型的函数,可以判断它创建成功否。
    使用递归算法实现。
    程序如下:
    function SubStr(vat dir:string):string;
    begin
      ...  
    end;if not Createdirectory(Pchar(edit1.txt),null) then
    begin
       ...
    end;
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);var
      Dir: string;
    begin  Dir := 'C:\APPS\SALES\LOCAL';  if ForceDirectories(Dir) then
        Label1.Caption := Dir + ' was created'end;
      

  3.   

    Createdirectory(Pchar(edit1.txt),null)