So here's the summary in simpler terms.
Error Type: Segmentation fault (core dumped) error.
No runtime error:
Total Cycles:10
for(int i=0; i<=10; i++){
skin.Read( "Body" );
}
Runtime error:
Total Cycles:4
std::map< std::string, std::map< std::string, std::string > >::iterator loop;
for ( loop=mainData.GetData().begin(); loop != mainData.GetData().end(); loop++ ){
skin.Read( "Body" );
}
No Runtime error:
Total Cycles:1
std::map< std::string, std::map< std::string, std::string > >::iterator loop;
for ( loop=mainData.GetData().begin(); loop != mainData.GetData().end(); loop++ ){
skin.Read( "Body" );
break;
}
//inside method skin.Read( const std::string );
std::cout << para_skinTypeValue.substr(0, para_skinTypeValue.find("($") );
para_skinTypeValue=para_skinTypeValue.substr(para_skinTypeValue.find("($")+2, para_skinTypeValue.length()-para_skinTypeValue.find("($")-2 );
EvaluateFunction( para_skinTypeValue.substr(0, para_skinTypeValue.find(")") ) );
para_skinTypeValue=para_skinTypeValue.substr(para_skinTypeValue.find(")")+1, para_skinTypeValue.length()-para_skinTypeValue.find(")")-1 );
and it seems like the
std::cout << para_skinTypeValue.substr(0, para_skinTypeValue.find("($") );
code is fine.
But the second line
para_skinTypeValue=para_skinTypeValue.substr(para_skinTypeValue.find("($")+2, para_skinTypeValue.length()-para_skinTypeValue.find("($")-2 );
causes the segmentation fault error when run twice inside the iterator. but doesn't create an error when run on a regular for loop.
[Edited by - Tradone on April 3, 2006 10:19:30 PM]