Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Viro

eof

This topic is 5940 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m trying to read some text from a file in Delphi. I seem to be misunderstanding how eof works. It seems to take a blank line as an EOF, which is wrong. I''ve got more text following that blank line. Here''s an example of the text I''m working with Line 1 Line 2 Line 3 My program will read Line 1 and Line 2, but EOF() will return true after reading Line 2 (eventhough there is Line 3). I need a way to solve this.

Share this post


Link to post
Share on other sites
Advertisement
Strange problem. Actually it should work fine. I've written a
short function to load a textfile and tested it.

Hope this helps.

var
f: Textfile;
s: String;

begin
memo1.clear;
if opendialog1.Execute then
begin
assignfile(f, opendialog1.Filename);
reset(f);
while not eof(f) do
begin
readln(f, s);
memo1.lines.add(s);
end;
closefile(f);
end;
end;

Hmm, the Code is a bit messed up.
Does anyone know how to fix this?

[edited by - Viperxxy on September 12, 2002 10:05:50 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!