Tinyxml を使用して Xml ファイルを再帰的に読み取ろうとしていますが、データにアクセスしようとすると、「セグメンテーション エラー」が発生します。コードは次のとおりです。
int id=0, categoria=0;
const char* nombre;
do{
ingrediente = ingrediente->NextSiblingElement("Ingrediente");
contador++;
if(ingrediente->Attribute("id")!=NULL)
id = atoi( ingrediente->Attribute("id") );
if(ingrediente->Attribute("categoria")!=NULL)
categoria = atoi ( ingrediente->Attribute("categoria") );
if(ingrediente!=NULL)
nombre = ( ( ingrediente->FirstChild() )->ToText() )->Value();
}while(ingrediente);
何らかの理由で、3 つの「if」行でセグメンテーション フォールトがスローされますが、どこに問題があるのかわかりません。
前もって感謝します。