如何在硬盘任一目录新建一个文本文件(*.txt),名字要自己取哟!

解决方案 »

  1.   

    function NewTextFile(filename:string);
    var st:tstringlist;
    begin
     st:=TStringList.Create;
     st.SaveToFile(ChangeFileExt(FileName,'.txt'));
     FreeAndNil(st):
    endl
      

  2.   

    NewTextFile('c:\windows\test');
    这样就生成了一个'c:\windows\test.txt'文件
      

  3.   

    var
    outfile: text;
    begin
    assign(outfile, 'c:\xx.txt');
    rewrite(outfile);
    writeln(outfile, 'Hello World');
    writeln(outfile, '哈哈');
    close(outfile);end.
      

  4.   

    同意:
    var
    outfile: text;
    begin
    assign(outfile, 'c:\xx.txt');
    rewrite(outfile);
    writeln(outfile, 'Hello World');
    writeln(outfile, '哈哈');
    close(outfile);end.给分,点贴子上方的 [管理]