|
-
November 16th, 2006, 08:04 AM
#1
Seeking specified character within a file
Hello,
What's the best way to seek to a certain delimiter character or string within a file?
I need to do this repeatedly, "jumping" from one occurance of the string to the next.
I know these strings will be somewhere towards the end of the file. Do I have to read from the begining, line by line until I encounter these delims?
-
November 16th, 2006, 11:03 AM
#2
Re: Seeking specified character within a file
Hi!
Well, IMO it's the only way, to read the whole file until you encounter the delimiter. Unless .NET already has some feature like this.
Another way is, if you are using your own file format, store offsets at the beginning of the file, so you could read them and seek to needed position in file. This saves some time if the file is big.
Using .NET 2.0 
-
November 16th, 2006, 12:28 PM
#3
Re: Seeking specified character within a file
Are you constrained by the type of file that you are using? Could you have your data in an XML file? Then you can find tags w/ ease.
Pete
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
|