Working with Text Files

netbug
11-05-2004, 05:51 PM
Well i am working in txt files..
when i open the program it opens the file .. and when i search in the file for specific line.. its ok for the first time..
while searching next time it gives me error End of File
how to move pointer to Begin of file without closing and opening it again...
Thanks

kevaholic00
11-05-2004, 06:00 PM
Try using Seek().

Revenge
11-05-2004, 07:14 PM
Idk what your actual code looks like but have you thought about adding a button, and then putting your seek code within that, that way every time you click the button it will run the code with out giving you an error. As long as you open and close the file within the button each time.

So Like....

Private Sub Forum Button_Click()
Open ' your code '
' your code '
Close 'your code number'
End Sub

netbug
11-06-2004, 05:13 PM
Well.
I cant use button. Because i am working on Intrusion Detection System.
when it recieves a packet and compares its fields with signatures in the text files. so i can click button for every packet i recieve...
it should work it self.. when i open it on every packet then it says after some time with error "Too Many files open"...
so i just want to move the pointer to BOF for every packet i recieve ...

Revenge
11-07-2004, 11:20 AM
Well.
I cant use button. Because i am working on Intrusion Detection System.
when it recieves a packet and compares its fields with signatures in the text files. so i can click button for every packet i recieve...
it should work it self.. when i open it on every packet then it says after some time with error "Too Many files open"...
so i just want to move the pointer to BOF for every packet i recieve ...

Well if it says "Too Many Files Open" are u making sure to close the files

Close #

or do you need all the files open

RoofRabbit
11-08-2004, 01:20 PM
Try
Seek FileHandleNumber, 1
The "1" is the first byte position of the file.

dealwithit47
11-08-2004, 01:55 PM
Try
Seek FileHandleNumber, 1
The "1" is the first byte position of the file.

does seek allow u to move to any postion in a txt file? Just a simple q because i work with files a lot and have always need away to move to a certain line in the file.

Sean

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum