String Matching Problem (NUXI problem) ?

T

timmu

I have a binary file (actually it's in memory)
which saved character as a reverse-byte order which means

ABCDEFGX stores as BADCFEXG

is there some function like strstr() in c standard library to match
substring "BCDE" (but in reverse-order for) how could I do it?

while I try to solve my problem myself,I found
ABCDEFGX may stores AYCBEDGFRX in the binary file, Y,R are some
characters I don't care.

this maybe called NUXI problem or something like that I try to google
it out but can't find anything useful.
 
B

Bill Pursell

timmu said:
I have a binary file (actually it's in memory)
which saved character as a reverse-byte order which means

ABCDEFGX stores as BADCFEXG

is there some function like strstr() in c standard library to match
substring "BCDE" (but in reverse-order for) how could I do it?

I'm not certain I understand your problem...if you
are trying to match "this string.", why don't
you just search for "htsis rtni.g"?
 
T

timmu

well, my problem is
"this string" may be presented like
"htsis rtni.g" or "tXih srtnig" where X character is something I don't
need.

actually I need to parse some strings like "arg1=On,arg2=False"
which "arg2" may present like "ra2gF=" or "a,gr=2"
 
J

Jordan Abel

I'm not certain I understand your problem...if you
are trying to match "this string.", why don't
you just search for "htsis rtni.g"?

Because he could be looking for "t?ih stsirgn?." instead?
 
B

Ben Bacarisse

I have a binary file (actually it's in memory)
which saved character as a reverse-byte order which means

ABCDEFGX stores as BADCFEXG

is there some function like strstr() in c standard library to match
substring "BCDE" (but in reverse-order for) how could I do it?

while I try to solve my problem myself,I found
ABCDEFGX may stores AYCBEDGFRX in the binary file, Y,R are some
characters I don't care.

this maybe called NUXI problem or something like that I try to google
it out but can't find anything useful.

The usual rule round here is to post actual (minimal) code the exhibits the
problem.

For example, cut down the program that "may store" ABCDEFGX as AYCBEDGRX,
post it here and you will be flooded with helpful replies.
 
E

Ed Prochak

timmu said:
I have a binary file (actually it's in memory)
which saved character as a reverse-byte order which means

ABCDEFGX stores as BADCFEXG

Actually it stored binary WORD values in little endian byte order. (at
least I think that's it. I sometimes confuse little endian and big
endian.)
is there some function like strstr() in c standard library to match
substring "BCDE" (but in reverse-order for) how could I do it?

Why not just write a simple filter program or routine to reverse the
bytes?
while I try to solve my problem myself,I found
ABCDEFGX may stores AYCBEDGFRX in the binary file, Y,R are some
characters I don't care.

this maybe called NUXI problem or something like that I try to google
it out but can't find anything useful.

try looking for little endian and big endian

ed
 
M

Malcolm

timmu said:
I have a binary file (actually it's in memory)
which saved character as a reverse-byte order which means

ABCDEFGX stores as BADCFEXG

is there some function like strstr() in c standard library to match
substring "BCDE" (but in reverse-order for) how could I do it?

while I try to solve my problem myself,I found
ABCDEFGX may stores AYCBEDGFRX in the binary file, Y,R are some
characters I don't care.

this maybe called NUXI problem or something like that I try to google
it out but can't find anything useful.
The best solution is to write a function

unscramble(char *littleendian)
{
}
This is trivial to implement. The only snag is that you need to know the
phase - whether you start in the middle of 16-bit block or not.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top