Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   Re: extracting string (http://www.velocityreviews.com/forums/t313831-re-extracting-string.html)

Zoran Cutura 06-26-2003 05:46 AM

Re: extracting string
 
qazmlp <qazmlp1209@rediffmail.com> wrote:
> const char* big = "abcdefgh123" ;
> const char* small = "bcd" ;
>
> Now, I want to extract the remaining string from big, after the small
> contents.
> That is the result string should have "efgh123".
>
> I am confused about how to do it ?
>
> Please help! Thanks!


strstr() is your friend. It will find your needle in the haystack, the
returned pointer will point to the beginning of the needle, adding
strlen(small) to that pointer will yield a pointer to the position after
that substring.

--
Z (Zoran.Cutura@daimlerchrysler.com)
"LISP is worth learning for the profound enlightenment experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days." -- Eric S. Raymond


All times are GMT. The time now is 06:04 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57