Input information from the second line of external file (text) - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Input information from the second line of external file (text)

SlladSllad Posts: 19Member
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

Comments

  • zibadianzibadian Posts: 6,349Member
    : 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:
    [code]
    while not eof(f) do
    begin
    Readln(f, var1);
    ...
    end;
    [/code]
  • SlladSllad Posts: 19Member
    : : 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:
    : [code]
    : while not eof(f) do
    : begin
    : Readln(f, var1);
    : ...
    : end;
    : [/code]
    :
    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...

  • zibadianzibadian Posts: 6,349Member
    : : : 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:
    : : [code]
    : : while not eof(f) do
    : : begin
    : : Readln(f, var1);
    : : ...
    : : end;
    : : [/code]
    : :
    : 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:
    [code]
    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
    [/code]
Sign In or Register to comment.