Results 1 to 10 of 10

Thread: Eof

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2001
    Location
    Sweden
    Posts
    174

    Eof

    I want to read a file, which i don't know the lenght of.

    shouldn't that be something like this:

    dim temp2(99) as string
    temp = freefile
    open "whatever.txt" for input as temp
    do while eof(temp)
    input temp, temp2(i)
    i = i +1
    loop
    [In time of development time stands still]

  2. #2
    jim mcnamara
    Guest
    Code:
    I want to read a file, which i don't know the lenght of. 
    
    shouldn't that be something like this: 
    
    dim temp2(99) as string 
    temp = freefile 
    i=1
    open "whatever.txt" for input as temp 
    do while NOT eof(temp) 
    input temp, temp2(i) 
    i = i +1 
    loop

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2001
    Location
    Sweden
    Posts
    174
    input temp, temp2(i) doesn't work.
    it says "Expected #"
    [In time of development time stands still]

  4. #4
    Addicted Member mepaco's Avatar
    Join Date
    Mar 2002
    Location
    Jackson, MS
    Posts
    185
    Originally posted by jim mcnamara
    Code:
    I want to read a file, which i don't know the lenght of. 
    
    shouldn't that be something like this: 
    
    dim temp2(99) as string 
    temp = freefile 
    i=1
    open "whatever.txt" for input as #temp 
    do while NOT eof(temp) 
    input #temp, temp2(i) 
    i = i +1 
    loop
    then add them

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2001
    Location
    Sweden
    Posts
    174
    k, its working now, thanks!
    [In time of development time stands still]

  6. #6
    Addicted Member mepaco's Avatar
    Join Date
    Mar 2002
    Location
    Jackson, MS
    Posts
    185

    Talking

    anytime

  7. #7
    Addicted Member
    Join Date
    Nov 2001
    Location
    Peterborough, UK
    Posts
    160

    Re: Eof

    Originally posted by eXterminator
    I want to read a file, which i don't know the lenght of.

    shouldn't that be something like this:

    dim temp2(99) as string
    temp = freefile
    open "whatever.txt" for input as temp
    do while eof(temp)
    input temp, temp2(i)
    i = i +1
    loop
    Always hoping, of course, that the file has less than 100 lines in it, otherwise consider using redim????

    Pigmy
    Remember - The light at the end of the tunnel could well be an on-coming train !

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Oct 2001
    Location
    Sweden
    Posts
    174
    I know, that was just an example. It read code looks a bit different.
    [In time of development time stands still]

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Oct 2001
    Location
    Sweden
    Posts
    174
    Argh,!!! my mean "The real code look a bit different"
    [In time of development time stands still]

  10. #10
    jim mcnamara
    Guest
    fairly goof proof way to read a text file into an array
    Code:
    Dim str() as string
    Dim tmp as String
    Open "myfile" for input as #1
    tmp = input(LOF(1),1)
    str=Split(tmp,vbCrLf)
    The number of array elements is Ubound(str)

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