Results 1 to 4 of 4

Thread: Input - Please help me - its urgend

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Location
    Vienna
    Posts
    1
    Hi,

    I wrote a Prog. that read me 10 lines from a file in ( for n = 1 to 10 ... )
    Is there any way to read the 11th to 20th line in? ( for n = 10 to 20 dont
    work )
    He should leave the first 10 lines alone, and only read the 11th to the 20th
    file...

    thanks.
    Kreuzer Michael


  2. #2
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Columbia, SC USA
    Posts
    374
    The code would be n = 11 to 20 and not n = 10 to 20. But could you post the code that you are using? Maybe it is another problem.

    Andrew

  3. #3
    Hyperactive Member Juan Carlos Rey's Avatar
    Join Date
    Aug 1999
    Location
    Mendoza, Argentina
    Posts
    301
    Read the 10 first lines into a dumb variable, then the lines you really want to read:

    -----
    For i = 1 to 10
    Line Input #1, a$
    Next

    For i = 11 to 20
    Line Input #1, a$
    Do Your Stuff
    Next
    Close
    -----

    Or, if you want to read the rest of the file:

    -----
    While Not EOF(1)
    Line Input #1, a$
    Do Your Stuff
    Next
    Close
    -----

    [Edited by Juan Carlos Rey on 03-26-2000 at 06:39 PM]

  4. #4
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    A little correction

    Juan Carlos' code:
    Code:
    While Not EOF(1) 
        Line Input #1, a$ 
        Do Your Stuff 
    Next 
    Close
    Should be:
    Code:
    While Not EOF(1) 
        Line Input #1, a$ 
        Do Your Stuff 
    Wend 
    Close


    All the best.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width