Given the following:
for( std::string line; getline( input, line ); )
{
CString strFind = line.c_str();
int n = strFind.ReverseFind( '\\' );
CString s = CString( strFind,n );
cout << s << endl;
// m_Path.push_back( line.c_str() );
}
It is reading a .ini configuration and on this .ini I have a line:
C:\Downloads\Insanity\Program\7. World.exe
this line is added to the vector<CString>
.
My problem isint n = strFind.ReverseFind( '\\\' );
finds the string pos of the first \ searching from the end of the string to the beginning, after when constructing a CString like this CString s = CString( strFind,n );
I'm constructing the FIRST n characters on the string so s
is equal C:\Downloads\Insanity\Program
but what I want is to copy 7 .World.exe
to the CString s
and not the other way, how can I do that using CString
or std::string
?