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.
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);
#define <string.h>
oops #include and not #define
ASKER
It was there when I got this warning.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
"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