Quote:
|
Originally Posted by Jack Jones
Been a long time, but looks like Pascal?
|
That's Delphi, (formerly Object Pascal). (Some of us
were "Delphi language nerds" in a former life....)
Alright, what's going on here? You want to read from a textfile, and pass the output to a memo box? First of all, if you're using the
try structure, you're probably familiar with exception handling. Can I assume that you want to check the status of the file reading operation, and throw an exception on an error?* And further, I'll assume that you're using the built-in textfile routines (check the Delphi help for the code example for
AssignFile), and not the binary file routines.
To read until the end of file, try using the
EOF function to determine whether you've reached the end of the file (check the documentation; there's surely an example that you can study).
Don't call your variable "readfile". There's a built-in function with that name already. (It won't interfere with your program, unless you use
ReadFile, but it's bad style.)
To reiterate, you're in the wrong place for Delphi help; didn't you see the message when you posted that tells you that this forum isn't normally used for the Delphi language?
*This is ugly, from a UI point of view. Try to make a "friendly" error message, rather than let the user see a Windows exception. To do this, you could use try with the except block.