1>c:\users\wendy chirs\desktop\inti\oop\jye\jye\jye\testingcall.cpp(5): error C2556: 'char *strstr(const char *,const char *)' : overloaded function differs only by return type from 'const char *strstr(const char *,const char *)'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\string.h(196) : see declaration of 'strstr'
1>c:\users\wendy chirs\desktop\inti\oop\jye\jye\jye\testingcall.cpp(5): error C2373: 'strstr' : redefinition; different type modifiers
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\string.h(196) : see declaration of 'strstr'
1>c:\users\wendy chirs\desktop\inti\oop\jye\jye\jye\testingcall.cpp(26): error C2556: 'char *strstr(const char *,const char *)' : overloaded function differs only by return type from 'const char *strstr(const char *,const char *)'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\string.h(196) : see declaration of 'strstr'
1>c:\users\wendy chirs\desktop\inti\oop\jye\jye\jye\testingcall.cpp(26): error C2491: 'strstr' : definition of dllimport function not allowed
It's because there is a function named strstr that returns a const char*, and as the error says, you can't overload functions based on the return type alone.
vlad, I that doesn't solve the problem, as std::strstr() is defined in the std namespace AND in the global namespace as well: so ::strstr() would still clash with the standard strstr().
vlad, I that doesn't solve the problem, as std::strstr() is defined in the std namespace AND in the global namespace as well: so ::strstr() would still clash with the standard strstr().
It is implementation defined whether C standard function are defined in the global namespace or not. Moreover in the original code the header <cstring> is not included. So it can be that in the header <string> only using declarations are used which do not include strstr.
You're right vlad. But in VS, (what OP is using) <cstring> is included (probably from <string>).
@Lim Boon Jye : You can do additive arithmetic with pointers, so subtract input1 from the result of strstr(). This should give you 3. (Of course, check for NULL before).