Delphi Drawers

ファイルのテキストを取得

テキストファイルの中身を取得します。

function fnReadFile(strFilePath:string;var strText:string):boolean;
var
  stlText:TStringList;
  bExsists:boolean;
begin
  strText := '';
  stlText := TStringList.Create;
  try
    bExsists := FileExists(strFilePath);
  except
    result := False;
    exit;
  end;
  if bExsists then begin
    result := True;
    stlText.Clear;
    try
      stlText.LoadFromFile(strFilePath);
      strText := stlText.Text;
    except
      result := False;
    end;
    stlText.Free;
  end else begin
    result := False;
  end;
end;
Copyright © 2006 Hikijishi All Rights Reserved.
[] [delphi][0.00164484977722168]