|
Thread: Eof
-
Apr 19th, 2002, 11:23 AM
#1
Thread Starter
Addicted Member
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]
-
Apr 19th, 2002, 11:27 AM
#2
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
-
Apr 19th, 2002, 11:36 AM
#3
Thread Starter
Addicted Member
input temp, temp2(i) doesn't work.
it says "Expected #"
[In time of development time stands still]
-
Apr 19th, 2002, 11:39 AM
#4
Addicted Member
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
-
Apr 19th, 2002, 11:43 AM
#5
Thread Starter
Addicted Member
k, its working now, thanks!
[In time of development time stands still]
-
Apr 19th, 2002, 11:43 AM
#6
Addicted Member
-
Apr 19th, 2002, 05:11 PM
#7
Addicted Member
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 !
-
Apr 19th, 2002, 05:16 PM
#8
Thread Starter
Addicted Member
I know, that was just an example. It read code looks a bit different.
[In time of development time stands still]
-
Apr 19th, 2002, 05:17 PM
#9
Thread Starter
Addicted Member
Argh,!!! my mean "The real code look a bit different"
[In time of development time stands still]
-
Apr 19th, 2002, 05:17 PM
#10
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|