string matching in c++

Vlearns
Vlearns used Ask the Experts™
on
i see the following output in gdb

--------------------
(gdb) p mes
$3 = 0x139a410 "Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)\r\nFrom: Fred r <foobar@Blurdybloop.COM>\r\nSubject: afternoon meetingTo: mooch@owatagu.siam.edu\r\nMessage-Id: <B27397-0100000@Blurdybloop.COM>\r\nMIME-Version: 1.0\r\nContent-Type: TEXT/PLAIN; CHARSET=US-ASCII\r\n\r\nHello Joe, do you think we can meet at 3:30 tomorrow?"

-----------------

i have another variable that holds the string

B27397-0100000@Blurdybloop.COM

i want to see if the above string exists in mess and return a true or false in the most efficient manner...........whats the best way of doing this?


thanks!


this is c++ on unix

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
for mess the declaration is

const char *mess

Top Expert 2009
Commented:
Something like this :
char* pos = strstr(mes, "B27397-0100000@Blurdybloop.COM");
if (pos) {
  /* substring found */
}

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial