Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Compare strings

elisguguelisgugu Member Posts: 2
Hello all of you!
I have to do that:
Open a file, read the data into a buffer and for example:

123123567567123567890125124

let`s imagine that I have that in the buffer.
Could you tell me way to compare 3 bytes with the other and counts how many times every sequence appears in two tables like this:

I table
|BYTES|
|123 |
|567 |
|890 |
|125 |
|124 |

II table
IDBYTES|OFFSET|COUNT|
1 |0 | 2 |
1 |12 1 |

and so on.
It counts and store the offset and if we have 123123 counts 2 times and store the first apear of the sequential.
I wrote a function but when I passed a bigger buffer it crashed.
Please tell me a simple way to do that!

Sign In or Register to comment.