linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fundu <fundu_1999@yahoo.com>
To: Bert Wesarg <bert.wesarg@googlemail.com>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: strstr and strchr
Date: Tue, 17 Feb 2009 03:52:12 -0800 (PST)	[thread overview]
Message-ID: <937267.9085.qm@web63401.mail.re1.yahoo.com> (raw)
In-Reply-To: <36ca99e90902170248y5ae1dc8heb5e4873429f3ae@mail.gmail.com>

Bert,
i did try that but got same response. 


--- On Tue, 2/17/09, Bert Wesarg <bert.wesarg@googlemail.com> wrote:

> From: Bert Wesarg <bert.wesarg@googlemail.com>
> Subject: Re: strstr and strchr
> To: fundu_1999@yahoo.com
> Cc: linux-c-programming@vger.kernel.org
> Date: Tuesday, February 17, 2009, 2:48 AM
> On Tue, Feb 17, 2009 at 09:30, Fundu
> <fundu_1999@yahoo.com> wrote:
> > looks strange to me
> > if i look for a str using strstr it gives me the
> starting index of the string. so let say if i'm looking
> for "firstName" in "<Info
> firstName=\"sam\"
> lastName=\"Smith\" />" using
> > strstr(ptr, "firstName");  i would get the
> pointer pointing to the f in firstName.
> >
> >
> > whereas if i use strchr and using a slight variation
> of the string mentioned above(suing ' instead of ")
>  "<Info firstName='sam'
> lastName='Smith'/>"
> > strchr(ptr, "'") returns a pointer
> pointing after the '
> strchr() takes a int as second argument, not a 'char
> *', I suggest trying:
> 
> strchr(ptr, '\'')
> 
> > so a printf("[%s]\n", strchr(ptr,
> "'"));
> > would print [  lastName='Smith'/>]
> >
> > which doesn't make sense to me.
> >
> > can someone shed some light. TIA !
> --
> 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


      

  reply	other threads:[~2009-02-17 11:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-17  8:30 strstr and strchr Fundu
2009-02-17 10:48 ` Bert Wesarg
2009-02-17 11:52   ` Fundu [this message]
2009-02-17 11:58     ` Bert Wesarg
2009-02-17 12:00       ` Bert Wesarg

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=937267.9085.qm@web63401.mail.re1.yahoo.com \
    --to=fundu_1999@yahoo.com \
    --cc=bert.wesarg@googlemail.com \
    --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).