Re: Search through a (large) binary file.
- From: "Michelle" <michelle@xxxxxxxxxxxxxxx>
- Date: Wed, 16 Sep 2009 17:10:17 +0200
Peter,
[. . .]
You can use the Position property to adjust from where you're reading inInt64 Offset1 = (ibBaseOffset + ibOffset); offset = 41152
the file; save the current position, set the current position to 4 bytes
earlier than the offset of the found string, read the 4 bytes of
interest, then restore the current position to the previously saved
value.
Int64 Offset2 = stream.Position; offset = 49152
Why is Offset1 not equal to Offset2 ?
Offset1 is the right offset. Changing the block size has affect ( byte[]
rgbBlockCur = new byte[4096]; )
I tried several options with stream.Seek(Offset, SeekOrigin) to set the
current position and restore the previously saved position.
But when I read the previous 4 bytes and restore the position to the
previous saved,
the returned offset is not right anymore. The search continues, but it's not
the right offset anymore.
The first 'hit' has a right offset and the previous read bytes are right.
After restoring the position to the previous saved, then it goes wrong.
Michelle
.
- Follow-Ups:
- Re: Search through a (large) binary file.
- From: Peter Duniho
- Re: Search through a (large) binary file.
- References:
- Search through a (large) binary file.
- From: Michelle
- Re: Search through a (large) binary file.
- From: Michelle
- Re: Search through a (large) binary file.
- From: Peter Duniho
- Re: Search through a (large) binary file.
- From: Michelle
- Re: Search through a (large) binary file.
- From: Peter Duniho
- Re: Search through a (large) binary file.
- From: Michelle
- Re: Search through a (large) binary file.
- From: Peter Duniho
- Search through a (large) binary file.
- Prev by Date: Re: simple example
- Next by Date: Re: GROUP By and Having count in LinQ
- Previous by thread: Re: Search through a (large) binary file.
- Next by thread: Re: Search through a (large) binary file.
- Index(es):
Relevant Pages
|