|
-
Nov 28th, 2001, 08:38 AM
#1
Thread Starter
Member
Get 20 last items in a textfile??
My my isn't working correctly right now... How do I the easiest way get the 20 last items in a text file?
Big thanks!
-
Nov 28th, 2001, 08:41 AM
#2
Frenzied Member
20 last items of...what? A listbox? An array? A Grid?
-
Nov 28th, 2001, 08:45 AM
#3
By "the 20 last items" do you mean the last 20 rows of text?
If every line is separated with a newline then use the Split function to get an array with each line in it.
-
Nov 28th, 2001, 08:53 AM
#4
Thread Starter
Member
In the textfile there are hundreds or even thousands of values. It could look like this:
5,4,3,8,66,44,3,4,5
I am only interested in the last twenty of these. I guess I can use spilt to make an array.
-
Nov 28th, 2001, 08:57 AM
#5
Frenzied Member
You can try this:
Dim Values(20) as String
Dim FromFile As (whatever the values are, perhaps Integer)
Dim I as Byte
' file 1 must already be open
Do until EOF(1)
Input #1, FromFile
For I = 1 to 19
Values(I) = Values(I + 1)
Next I
Values(20) = FromFile
Loop
This should end up with the last 20 items. It might be slow on Really big files, but it should do the job.
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
|