- char cible[MED_SNAME_SIZE +1];
- strncpy(cible,comp+j*MED_SNAME_SIZE,MED_SNAME_SIZE );
- cible[MED_SNAME_SIZE ]='\0';
- ListeComposants.push_back(QString(cible));
+// Lecture du nombre de composantes
+ med_int ncomp = MEDfieldnComponent(medIdt,i+1);
+// Lecture du type du champ, des noms des composantes et du nom de l'unite
+ char nomcha [MED_NAME_SIZE+1];
+ char meshname[MED_NAME_SIZE+1];
+ char * comp = (char*) malloc(ncomp*MED_SNAME_SIZE+1);
+ char * unit = (char*) malloc(ncomp*MED_SNAME_SIZE+1);
+ char dtunit[MED_SNAME_SIZE+1];
+ med_bool local;
+ med_field_type typcha;
+ med_int nbofcstp;
+ erreur = MEDfieldInfo(medIdt,i+1,nomcha,meshname,&local,&typcha,comp,unit,dtunit,&nbofcstp) ;
+ free(unit);
+ if ( erreur < 0 )
+ {
+ free(comp);
+ QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
+ QObject::tr("HOM_MED_FILE_6") );
+ break ;
+ }
+ // Lecture des composantes si c'est le bon champ
+ if ( QString(nomcha) == aChamp )
+ {
+ for (int j = 0; j <ncomp; j++)
+ {
+ char cible[MED_SNAME_SIZE +1];
+ strncpy(cible,comp+j*MED_SNAME_SIZE,MED_SNAME_SIZE );
+ cible[MED_SNAME_SIZE ]='\0';
+ ListeComposants.push_back(QString(cible));
+ }
+ }
+ // Menage
+ free(comp);
+ // Sortie si c'est bon
+ if ( QString(nomcha) == aChamp ) { break ; }