Salut,
qqun saurait pourquoi mon pXMLDoc.detach() fait planer le programme à la
fin. J'ai souvenir qu'il marchait à un certain moment, mais depuis j'ai
rajouté des fonctions.
De * Fre
int main(int argc, char* argv[])
{
USES_CONVERSION ;
//Initialisations
IXMLDOMDocument2Ptr pXMLDom;
IXMLDOMNodePtr pXMLDNode;
IXMLDOMNodeListPtr pXMLDNodeList;
/********************/
//IXMLDOMNodeList **resultList;
HRESULT hr;
CoInitialize(NULL);
hr= pXMLDom.CreateInstance(__uuidof(DOMDocument40));
if (FAILED(hr))
{
printf("Failed to instantiate an XML DOM.\n");
return -1;
}
pXMLDom->async = VARIANT_FALSE; // default - true,
if(pXMLDom->load("structoui.xml"/*path of the xml*/)!=VARIANT_TRUE)
{
printf("Failed to load xml:\n%s\n",
(LPCSTR)pXMLDom->parseError->Getreason());
return -1;
}
/********* APPELS DES FONCTIONS *****/
cout <<"la premiere song du morceau est: " <<PremiereSong(pXMLDom) <<endl;
char yo[4] = "001"; // ! ATTENTION à la longueur en fonction de la longueur
de ton int !
cout <<"Le tempo de cette song est: "<<Tempo(pXMLDom, yo) <<endl;
cout <<"les song suivantes possibles sont: " <<songsuiv(pXMLDom, yo);
cout <<"il y a " <<nbinst(pXMLDom, yo) <<" instruments dans cette song"
<<endl;
cout <<"le nombre de mesures de la song est: " <<nbmesures(pXMLDom, yo)
<<endl;
int i = 0;
char ** nom = new char*;
char ** nom2 = new char*;
cout <<"Le nom des samples de début dispos est: "<<endl;
nom = nomsampledeb(pXMLDom, yo, "1") ; //on accede aux noms en accedant le
tableau nom à partir de 1 il ya nom[0] samples dans ce tableau
for (i = 0; i < atoi(nom[0]); i++)
{
cout <<nom[i+1] <<endl;
}
cout <<"Le nom des samples de fin dispos est: "<<endl;
nom2 = nomsamplefin(pXMLDom,"0001243.wav", yo, "1") ; //on accede aux noms
en accedant le tableau nom à partir de 1 il ya nom[0] samples dans ce
tableau
for (i = 0; i < atoi(nom2[0]); i++)
{
cout <<nom2[i+1] <<endl;
}
cout <<"fin";
cin >>i;
/* il faut libérer tous les trucs dynamiques alloués */
pXMLDom.Detach();
return 0;
}
--
Devenez redacteur <XML>fr et contribuez au developpement du
xml francophone (http://xmlfr.org/infos/redacteurs/) !
Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
Cette liste est a votre disposition pour discuter en francais de
tout sujet technique lie a XML.
Pour resilier votre abonnement, envoyez un message contenant
la commande "unsubscribe" a xml-tech-request@xmlfr.org
(mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
Received on Tue Jul 1 14:38:01 2003