请问,如何在DELPHI程序里面打开一个TXT文件。

解决方案 »

  1.   

    use ShellApi;  if FileExists(sFileName) then
        ShellExecute(Handle,'open',PChar(sFileName),nil,nil,SW_SHOWNORMAL)
      

  2.   

    如果是读出其中内容:
    var
      tFile : TextFile;
      sTxt:String;
    begin 
      if OpenDialog1.Execute then
      begin
        AssignFile(tFile ,OpenDialog1.FileName);
        Reset(tFile);
        while not EOF(tFile) do
          Readln(tFile,sTxt);  //读出每一航
      end;如果需要直接打开TXT文件可以使用;
    ShellExecute(0, ‘open',路径,'','', 0);
      

  3.   

    打开????
    当然是用ShellExecute(0, ‘open',路径,'','', 0);