I was playing with some of the string functions and the VS help says that rfind returns npos if it doesn't find the string I'm searching for in the string I'm searching in. I thought npos was some sort of enumerated type or something. But I get an error and I tried to do it like they show the examples. Anyone help me please?
--------------------Configuration: STRNG - Win32 Debug--------------------PHP Code:
#include <string>
#include <iostream>
using namespace std;
int main()
{
cout<<"enter a word";
string astring;
cin>>astring;
if(!(astring.rfind("A")==npos))
{
//do whatever if it finds the letter
}
return 0;
}
Compiling...
main.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\AddIns\Strng\main.cpp(11) : error C2065: 'npos' : undeclared identifier
Error executing cl.exe.