* Re: What means "\xc7\x44\x24\x18\xda\xff\xff\xff\xe8" ?
2006-04-05 4:03 ` Glynn Clements
@ 2006-04-05 4:32 ` Niklaus
0 siblings, 0 replies; 3+ messages in thread
From: Niklaus @ 2006-04-05 4:32 UTC (permalink / raw)
Cc: openbsd shen, linux-c-programming
On 4/5/06, Glynn Clements <glynn@gclements.plus.com> wrote:
>
> openbsd shen wrote:
>
> > In a get_sct() function, it have some lines:
> >
> > pt = (char *) memmem(p+7, SCLEN-(p-code)-7,
> > "\xc7\x44\x24\x18\xda\xff\xff\xff\xe8", 9);
> > if (!pt)
> > return 0;
> >
> >
> > when run here, it always return 0, so I want to know what means the
> > "\xc7\x44\x24\x18\xda\xff\xff\xff\xe8" ?
>
> It's just the string of bytes being searched for, specified as a C
> string literal using hexadecimal codes.
Since the characters are not printable he has given it the values of
ascii characters in hexadecimal. It always returns NULL , maybe
because the text you are running it on doesn't have that string. Try
running it on the string containing ÇD$Úÿÿÿè
It will not return NULL.
Just look into man memmem
#include<stdio.h>
#include<string.h>
#include<stdio.h>
int main()
{
char *s="\xc7\x44\x24\x18\xda\xff\xff\xff\xe8";
char *s1="\x4e\x49\x4b";
char s2[]="Niklaus";
char s3[]="IINIKlaus";
char s4[]="HiÇD$ÚÿÿÿèHiya";
printf("%s\n",s);
printf("%s\n",s1);
printf("%s\n", memmem(s2,sizeof(s2),s1,3));
printf("%s\n", memmem(s3,sizeof(s3),s1,3));
printf("%s\n", memmem(s4,sizeof(s4),s,3));
return 0;
}
~
>
> --
> Glynn Clements <glynn@gclements.plus.com>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread