Hello Bart!
Monday March 31 1997 15:51, Bart Broersma wrote to Bryan Smith:
BB> This however will not solve the problems of
BB> - files > 32K
BB> - disk read errors
BB> - other failures in reading the file.
I solved some of your problems with this construct in one of my own programs:
var
InputFile: TextFile;
BufferCount : Integer;
TextLine: String;
---
IF LENGTH(IN_FILE)>0 THEN
BEGIN
TRY
FILEMEMO.Lines.BeginUpdate;
AssignFile(InputFile, IN_FILE);
Reset(InputFile);
BufferCount := 0;
WHILE (BufferCount<30000) AND (NOT Eof(InputFile)) DO
BEGIN
ReadLn(InputFile, TextLine);
TRY
FILEMEMO.Lines.Add(TextLine);
EXCEPT
BufferCount := 31000;
END;
Inc(BufferCount, Length(TextLine)+2);
END;
FINALLY
CloseFile(InputFile);
FILEMEMO.Lines.EndUpdate;
END;
This construct solved the LoadFromFile exception. Not pretty code but it does
the job.
Ken
... Public speaking is very easy.
--- GoldED/386 3.00.Alpha4+
---------------
* Origin: The Falcon's Nest * The Ghetto * +45 86 25 52 45 (2:238/31.1)
|