On 4/5/06, Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxx> > - > : send the line "unsubscribe linux-c-programming" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html > - : send the line "unsubscribe linux-c-programming" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html