From: Ibraheem Umaru-Mohammed <iumarumo@eidosnet.co.uk>
To: Ken Martwick <kenm@efn.org>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: substring offset
Date: Sat, 31 Aug 2002 22:21:22 +0100 [thread overview]
Message-ID: <20020831212122.GB1372@micromuse.com> (raw)
In-Reply-To: <Pine.GSU.4.21.0208311110210.17325-100000@garcia.efn.org>
["Ken Martwick"="Ken"]
Ken >> In this code snippet,
Ken >>
Ken >> findptr = strstr(realine[n], search);
Ken >> if(findptr)
Ken >> {
Ken >> diff = (int)(findptr - realine[n]);
Ken >>
Ken >> why isn't "diff" the offset of "search" in "realine[n]"? How
Ken >> can I calculate the offset?
Ken >> Ken Martwick
Ken >>
You want to use the address of realine[n]. i.e
,---- <code>
| ...
| findptr = strstr(&realine[n],search);
| if( findptr )
| {
| diff = findptr - &realine[n];
| ...
`----<code/>
Kindest regards,
--ibz.
--
Ibraheem Umaru-Mohammed
"ibz"
umarumohammed (at) btinternet (dot) com
prev parent reply other threads:[~2002-08-31 21:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-31 18:11 substring offset Ken Martwick
2002-08-31 21:21 ` Ibraheem Umaru-Mohammed [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=20020831212122.GB1372@micromuse.com \
--to=iumarumo@eidosnet.co.uk \
--cc=kenm@efn.org \
--cc=linux-c-programming@vger.kernel.org \
/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).