[fpc-devel] Benchmark for FreePascal
Jonas Maebe
jonas.maebe at elis.ugent.be
Sun Dec 11 17:44:37 CET 2005
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
More information about the fpc-devel
mailing list