Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4106
Number of posts: 14016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Input information from the second line of external file (text) Posted by Sllad on 25 Jan 2007 at 10:23 PM
Thnx for the answer in my other subject. Plz answer this one too ;)

How can i insert information from the second line, third, fourth etc lines? (not all toghether, one - one) (integers, one integer per line)

Thnx in advance
Report
Re: Input information from the second line of external file (text) Posted by zibadian on 25 Jan 2007 at 11:02 PM
: Thnx for the answer in my other subject. Plz answer this one too ;)
:
: How can i insert information from the second line, third, fourth etc lines? (not all toghether, one - one) (integers, one integer per line)
:
: Thnx in advance
:
Use a while do loop:
  while not eof(f) do
  begin
    Readln(f, var1);
    ...
  end;

Report
Re: Input information from the second line of external file (text) Posted by Sllad on 26 Jan 2007 at 5:51 AM
: : Thnx for the answer in my other subject. Plz answer this one too ;)
: :
: : How can i insert information from the second line, third, fourth etc lines? (not all toghether, one - one) (integers, one integer per line)
: :
: : Thnx in advance
: :
: Use a while do loop:
:
:   while not eof(f) do
:   begin
:     Readln(f, var1);
:     ...
:   end;
: 

:
Cool, how do i use that for multiple lines (when i say multiple number can get up to 100 and moe. Can't use eof 100 times...

Report
Re: Input information from the second line of external file (text) Posted by zibadian on 26 Jan 2007 at 8:12 AM
: : : Thnx for the answer in my other subject. Plz answer this one too ;)
: : :
: : : How can i insert information from the second line, third, fourth etc lines? (not all toghether, one - one) (integers, one integer per line)
: : :
: : : Thnx in advance
: : :
: : Use a while do loop:
: :
: :   while not eof(f) do
: :   begin
: :     Readln(f, var1);
: :     ...
: :   end;
: : 

: :
: Cool, how do i use that for multiple lines (when i say multiple number can get up to 100 and moe. Can't use eof 100 times...
:
:
While-do is a loop. What happens is this:
if not eof(f) then
begin
  readln()
  if not eof(f) then // Second time through the loop
  begin
    readln()
    if not eof(f) then // Third time through the loop
    begin
      readln()
      if not eof(f) then // fourth time through the loop
      begin
        // etc. until the end of file marker is reached




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.