MEDfichEntete.c

Aller à la documentation de ce fichier.
00001 /*  This file is part of MED.
00002  *
00003  *  COPYRIGHT (C) 1999 - 2015  EDF R&D, CEA/DEN
00004  *  MED is free software: you can redistribute it and/or modify
00005  *  it under the terms of the GNU Lesser General Public License as published by
00006  *  the Free Software Foundation, either version 3 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  MED is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU Lesser General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Lesser General Public License
00015  *  along with MED.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #include <med.h>
00019 #include <med_config.h>
00020 #include <med_outils.h>
00021 
00022 #include <string.h>
00023 
00024 med_err 
00025 MEDfichEntete(med_idt fid, med_fich_info quoi, char str[])
00026 {
00027   med_idt atid, root;
00028   med_err ret;
00029   char locale[MED_TAILLE_DESC+1];
00030   char chemin[MED_TAILLE_MAA+1];
00031 
00032   switch (quoi)
00033     {
00034     case MED_HDF_VERSION : 
00035       strcpy(str,HDF_VERSION_ACTUELLE);
00036       break;
00037 
00038     case MED_VERSION :
00039       strcpy(str,PACKAGE_VERSION);
00040       break;
00041 
00042     case MED_FICH_DES :
00043       /*
00044        * On inhibe le gestionnaire d'erreur HDF
00045        */
00046       _MEDmodeErreurVerrouiller();
00047 /* Ajout de la ligne suivante par un script malencontreux ?*/
00048 /* if (MEDcheckVersion(fid) < 0) return -1; */
00049 
00050       /*
00051        * On ouvre le Data Group racine
00052        */
00053       strncpy(chemin,MED_MAA,strlen(MED_MAA)-1);
00054       chemin[MED_TAILLE_MAA-1] = '\0';
00055       if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
00056         return -1;
00057 
00058       /*
00059        * On regarde si l'attribut existe
00060        * Si non => erreur
00061        * Si oui => on le copie dans str
00062        */
00063       if ((ret = _MEDattrStringLire(root,MED_NOM_DESCRIPTEUR,
00064                                     MED_TAILLE_DESC,locale)) < 0) {
00065         _MEDdatagroupFermer(root);
00066         return -1;
00067       }
00068 
00069       strcpy(str,locale);
00070       
00071       if ( _MEDdatagroupFermer(root) < 0)
00072         return -1;
00073 
00074       break;
00075       
00076     default :
00077       return -1;
00078     }
00079   return 0;
00080 }

Généré le Thu Oct 8 14:26:16 2015 pour MED fichier par  doxygen 1.6.1