Howdy, Stranger!

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

Categories

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.