•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Pascal and Delphi section within the Software Development category of DaniWeb, a massive community of 455,976 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,797 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Pascal and Delphi advertiser: Programming Forums
Views: 2760 | Replies: 30
![]() |
•
•
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation:
Rep Power: 13
Solved Threads: 193
I just tested it with gpc also.
There is a logic error, btw. You should have:
so as not to lose the last line of the file. (Unlike C and C++, Pascal is forward-capable when finding EOF.)
Hope this helps.
There is a logic error, btw. You should have:
Pascal Syntax (Toggle Plain Text)
i := 1; while not eof( t ) do begin readln( t, s ); writeln( 'line ', i, ': ', s ); inc( i ) end;
Hope this helps.
•
•
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation:
Rep Power: 13
Solved Threads: 193
If it is possible to read anything from the file, eof will not return true.
Therefore, while not eof, you can read and print a line of text.
Your previous code would read the last line of text, but not print it if eof was true. Hence, the last line of text was lost (read but not printed).
Wait, was that what your "how?" was for?
Therefore, while not eof, you can read and print a line of text.
Your previous code would read the last line of text, but not print it if eof was true. Hence, the last line of text was lost (read but not printed).
Wait, was that what your "how?" was for?
•
•
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation:
Rep Power: 13
Solved Threads: 193
•
•
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation:
Rep Power: 13
Solved Threads: 193
•
•
Join Date: Nov 2007
Posts: 44
Reputation:
Rep Power: 2
Solved Threads: 0
well it kinda worked.. change some things in the program and then it worked..
http://i29.tinypic.com/2wd3jus.jpg
Only repeating the first sentence.
how do I fix that?
http://i29.tinypic.com/2wd3jus.jpg
Only repeating the first sentence.
how do I fix that?
•
•
Join Date: Nov 2007
Posts: 44
Reputation:
Rep Power: 2
Solved Threads: 0
well it kinda worked.. change some things in the program and then it worked..
http://i29.tinypic.com/2wd3jus.jpg
Only repeating the first sentence.
how do I fix that?
http://i29.tinypic.com/2wd3jus.jpg
Only repeating the first sentence.
how do I fix that?
![]() |
•
•
•
•
•
•
•
•
DaniWeb Pascal and Delphi Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- New to Pascal and need to open project. (Pascal and Delphi)
- Could somebody tell me more dev-pascal code? (Pascal and Delphi)
Other Threads in the Pascal and Delphi Forum
- Previous Thread: help me..
- Next Thread: Dialer in VB6 or Delphi that works on XP?



Linear Mode