Do I really have to mess with memory allocation and pointers??
Anyone have a quick example of taking two strings and saying "is the
first in the second" ???
I don't care where, when or how many times, just, is the *^%$% string in
there.
Thanks
--
Keith Kaple x25759 -----------------------
| New distribution, $40. Linux compatible
| sound card, $89. Three button mouse, $18.
| Nuking windows partitions....priceless.
#include <stdio.h>
#include <string.h>
int is_the_first_in_the_second(const char *first, const char *second)
{
return strstr(second, first) != 0;
}
int main(void)
{
const char *clcFAQ = "http://www.eskimo.com/~scs/C-faq/top.html";
const char *FAQSalreadyread = "";
if(is_the_first_in_the_second(clcFAQ, FAQSalreadyread))
printf("ok\n");
else
printf("oops\n");
return 0;
}
--
-----------------------------------------------------------
Luis Grave mailto:lgr...@ccg.uc.pt
Dept. Teletrabalho, Visualisacao and Tecnologias Multimedia
Centro de Computacao Grafica http://www.ccg.uc.pt
-----------------------------------------------------------