On 11 Dec 2005, at 17:28, L505 wrote:

// TEST 5
function StrLoadFile_test5(const FileName: string): string;
var
  F: text;
  c: char;
  str1, Line: string;
  Buf : Array[1..100000] of byte;
begin
  result:= ''; //safety
  str1:= '';
  if FileExists(FileName) = false then
    exit;
  Assign(F, FileName);   //open file
  Reset(F);
  SetTextBuf(F, Buf);
  while not Eof(F) do
  begin
    Read(F, C);
    result:= result + C;
  end;

But why do you read char by Char? Why not

read(f, line);
result := result + line;

You can add a line break in between as well if you want.

  close(F); //close file
end;


Jonas
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to