botmaster
11-02-2006, 08:59 PM
The problem:
I need to open a file and read it as string till the end of the file. How could I do something like that? I know how to open files, and how to read a certain # of characters of it, but not how to get to the end of the file without causing a memory access violation. Any help?
The code so far:
function ReadFile(fileno : integer): string;
var
i: integer;
begin
repeat
ReadFileString(fileno, result, i);
i:= i+1;
until(EndOfFile(fileno)=true);
end;
I need to open a file and read it as string till the end of the file. How could I do something like that? I know how to open files, and how to read a certain # of characters of it, but not how to get to the end of the file without causing a memory access violation. Any help?
The code so far:
function ReadFile(fileno : integer): string;
var
i: integer;
begin
repeat
ReadFileString(fileno, result, i);
i:= i+1;
until(EndOfFile(fileno)=true);
end;