How do I prevent IO Error 32 when reading a file of unknown size in Delphi 7?

Question

Grade: Education Subject: Support
How do I prevent IO Error 32 when reading a file of unknown size in Delphi 7?
Asked by:
77 Viewed 77 Answers

Answer (77)

Best Answer
(284)
When reading a file of unknown size, use a loop that continues until `IOResult` returns 32 (EOF). Inside the loop, read a chunk of data at a time. This approach avoids attempting to read beyond the end of the file. Consider using `BlockRead` for efficient reading of larger blocks.