*\83X\83\8c\83b\83h\83t\83@\83C\83\8b\82©\82ç\8ew\92è\8ds\82ð\8eæ\93¾
*************************************************************************)
function TGikoSys.ReadThreadFile(FileName: string; Line: Integer): string;
-const
- BUFFER_SIZE = 1024;
var
- f: TextFile;
- s: string;
- num: Integer;
- ArrBuff: array [1..BUFFER_SIZE] of Char;
+ fileTmp : TStringList;
begin
Result := '';
if FileExists(FileName) then begin
- AssignFile(f, FileName);
- System.SetTextBuf(f, ArrBuff);
try
- Reset(f);
- num := 1;
- while not Eof(f) do begin
- Readln(f, s);
- if Line = num then begin
- Result := s;
-// CloseFile(f);
- Break;
- end;
- inc(num);
- end;
+ try
+ fileTmp.LoadFromFile( FileName );
+ if ( Line >= 1 ) and ( Line < fileTmp.Count + 1 ) then begin
+ Result := fileTmp.Strings[ Line-1 ];
+ end;
+ except
+ //on EFOpenError do Result := '';
+ end;
finally
- CloseFile(f);
+ fileTmp.Free;
end;
end;
end;