From: Niklaus <niklaus@gmail.com>
Cc: openbsd shen <openbsd.shen@gmail.com>,
linux-c-programming <linux-c-programming@vger.kernel.org>
Subject: Re: What means "\xc7\x44\x24\x18\xda\xff\xff\xff\xe8" ?
Date: Wed, 5 Apr 2006 10:02:19 +0530 [thread overview]
Message-ID: <85e0e3140604042132k443932dcs4eacc7b5954152cf@mail.gmail.com> (raw)
In-Reply-To: <17459.16807.734975.510348@cerise.gclements.plus.com>
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
prev parent reply other threads:[~2006-04-05 4:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-05 3:30 What means "\xc7\x44\x24\x18\xda\xff\xff\xff\xe8" ? openbsd shen
2006-04-05 4:03 ` Glynn Clements
2006-04-05 4:32 ` Niklaus [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=85e0e3140604042132k443932dcs4eacc7b5954152cf@mail.gmail.com \
--to=niklaus@gmail.com \
--cc=linux-c-programming@vger.kernel.org \
--cc=openbsd.shen@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).