有一些文本文件按一下的方式命名:1.txt 2.txt 3.txt  .... 我想文本文件的前几个字作为文件名我应该怎样做??
提问
读取一个×.txt文档的前面几个字符(遇到特定的字符中止)

解决方案 »

  1.   

    findFirst,FindNext查找txt文件,
    readln读文件,取前面的8个字符,再改名.
      

  2.   

    procedure TForm1.Button3Click(Sender: TObject);
    var
    f:System.TextFile;
    name,SourceDir:string;i:integer;
    begin
    SetLength(name,1000);
    for i:=0 to (filelistbox1.Count-1) do
    begin
    filelistbox1.ItemIndex:=i;
    SourceDir:=filelistbox1.FileName;
    AssignFile(f,SourceDir);
    Reset(f);
    readln(f,name);
    showmessage(name);
    Closefile(f);
    end;end;
      

  3.   

    用Copy()函数呀!
    有问题请发信息到我的E-mail:[email protected]