Re: Parsing Binary Files
From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 10/12/04
- Next message: Joey Callisay: "Re: referece equals"
- Previous message: Jon Skeet [C# MVP]: "Re: referece equals"
- In reply to: Hemang Shah: "Re: Parsing Binary Files"
- Next in thread: Niki Estner: "Re: Parsing Binary Files"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 12 Oct 2004 10:02:05 +0100
Hemang Shah <v-hshah@microsoft.com> wrote:
> Thank you Niki & Jon
>
> I took the sample and it worked for me. I was able to get proper matches.
>
> Now I have some questions if you don't mind me asking:
>
> 1) The code right now is Case Sensitive I guess to the string we want to
> search is that correct ?
Yes.
> 2) If I want it to be not case sensitive, do I type the string in every
> posible combination and search with each of those bytes ? or is there a
> better solution
Well, you could supply multiple byte arrays, and check whether the nth
byte is any of the acceptable ones, rather than just a single
acceptable one. You then just supply a lower case version and an upper
case version - you don't need to come up with every combination.
> 3) What I want to do is, after the search is met, I want to read x amount
> of characters after that search and display it. Now the # of characters
> after the search is not fixed, it could be 1 word or it could be a sentence.
> I would know it because it will truncate with another search string.
To what extent is this *really* a binary file? Pretty much everything
you've said has been in terms of text.
> 4) I don't understand the copying of buffer so that we can check across
> boundries, I understand the concept but I cannot follow the code from there.
I haven't actually looked at Niki's code myself.
> Also, how do I handle my fetching the info if it is across boundries.
> 5) Our input buffer is set to 16 bytes. Is there any reason its 16 ? or it
> could be any size.
It could be set to any size. I'd usually use about 32K myself.
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Next message: Joey Callisay: "Re: referece equals"
- Previous message: Jon Skeet [C# MVP]: "Re: referece equals"
- In reply to: Hemang Shah: "Re: Parsing Binary Files"
- Next in thread: Niki Estner: "Re: Parsing Binary Files"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|