tags:

views:

727

answers:

2

Hi, I am really new to C.

I want to use the strpos function but it is telling me it doesnt exist?

A: 

Yes. It's called strstr, related to strpos like (pseudo-code):

strpos(str, target) {
   res = strstr(str, target); 
   if (res == NULL) return false;
   else             return res - str;
}
KennyTM
+1  A: 

The function you are looking for might be either strstr or strchr. You then need to include string.h. There is no strpos in the POSIX interface.