[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Why warning message in using strcasestr() ?

Posted on 2008-11-06
5
Medium Priority
?
2,690 Views
Last Modified: 2012-05-05
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

0
Comment
Question by:akohan
  • 3
5 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 22901541
#define <string.h>
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 22901544
oops #include and not #define
0
 

Author Comment

by:akohan
ID: 22901602

It was there when I got this warning.
0
 
LVL 45

Accepted Solution

by:
sunnycoder earned 1000 total points
ID: 22902159
#define _GNU_SOURCE
#include <string.h>
0
 
LVL 4

Expert Comment

by:lhl60
ID: 22959235
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
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question