0
I’m getting this error in this code:
bool Configuration::GetConfigBlockLine(ifstream& file, string& key, string& value)
{
string line;
// end of file
while( !file.eof() )
{
// read line from config file
getline( file, line );
TrimString( line );
// end of object's data
if( line.compare( "#end" ) == 0 )
return false;
size_t p = line.find( '=' );
if( p != string.npos )
{
// key
key = line.substr( 0, p );
TrimString( key );
// value
value = line.substr( p + 1, line.length() );
TrimString( value );
// key - value pair read successfully
return true;
}
}
// error
return false;
}
Apparently it says string is not an allowed name, in if( p != string.npos )
but why this error occurs and how can I fix it.
Thank you! What’s this thing for?
– Elaine
ops, see new edition, with the corrected response
– zentrunix