Link to home
Start Free TrialLog in
Avatar of akohan
akohan

asked on

Why warning message in using strcasestr() ?

Hello group,

In following code, I'm getting warning messages as

warning: implicit declaration of function `strcasestr'
warning: assignment makes pointer from integer without a cast
warning: assignment makes pointer from integer without a cast

for using strcasestr(). As far I know the inputs must be const char* and its ouput must get into a char*.

Any idea where I went wrong?

Thanks.



const char* b_tag = "<title>";
       const char* e_tag = "</title>";
       char* p_start = NULL;
       char* p_end   = NULL;
 
       p_start = strcasestr(buf, b_tag);  //buf contains an html body
       p_end   = strcasestr(buf, e_tag);

Open in new window

Avatar of sunnycoder
sunnycoder
Flag of India image

#define <string.h>
oops #include and not #define
Avatar of akohan
akohan

ASKER


It was there when I got this warning.
ASKER CERTIFIED SOLUTION
Avatar of sunnycoder
sunnycoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you must be missing an include file, are your include paths ok?

"warning: implicit declaration of function `strcasestr'"

Because strcasstr is not defined any where,
the compiler will assume the default declaration of "unknown" functions

int strcasestr();

that explains:
warning: assignment makes pointer from integer without a cast
warning: assignment makes pointer from integer without a cast