Re: strstr and strchr
Bert Wesarg <[email protected]>
| Newsgroups | org.kernel.vger.linux-c-programming |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Feb 17, 2009 at 12:58, Bert Wesarg <[email protected]> wrote: > On Tue, Feb 17, 2009 at 12:52, Fundu <[email protected]> wrote: >> Bert, >> i did try that but got same response. > I'm not: > > int > main(int ac, char *av[]) > { > char *str = "<Info firstName='sam' lastName='Smith' />"; > char *ptr = strchr(str, '\''); > > if (!ptr) > return 1; > > printf("%s\n", str); > printf("%*s^\n", (int)(ptr - str), ""); > > return 0; > } > > prints: > > <Info firstName='sam' lastName='Smith' /> > ^ This looks probably wrong, because of malformed whitespace.