1 /*************************************************************************
2 * COPYRIGHT (C) 1999 - 2002 EDF R&D
3 * THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
4 * IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
5 * AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
6 * EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
8 * THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
9 * WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
10 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
11 * LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
13 * YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
14 * ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
15 * INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
17 *************************************************************************/
20 #include "med_outils.hxx"
23 * - Nom de la fonction : _MEDattrStringEcrire
24 * - Description : ecriture d'un attribut chaine de caracteres
26 * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
27 * - nom (IN) : le nom de l'attribut
28 * - longueur (IN) : strlen(val)
29 * - val (IN) : la valeur de l'attribut
30 * - Resultat : 0 en cas de succes, -1 sinon
36 _MEDattrStringEcrire(med_idt pere,char *nom,int longueur,char *val, med_mode_acces mode)
38 med_idt aid,attr, datatype;
41 if ((aid = H5Screate(H5S_SCALAR)) < 0)
43 if((datatype = H5Tcopy(H5T_C_S1)) < 0)
45 if((ret = H5Tset_size(datatype,longueur+1)) < 0)
48 if ( ((attr = H5Aopen_name(pere,nom)) > 0)
49 && (mode != MED_REMP) )
53 if ((attr = H5Acreate(pere,nom,datatype,aid,H5P_DEFAULT)) < 0) return -1;
55 if ((ret = H5Awrite(attr, datatype, val)) < 0)
58 if ((ret = H5Sclose(aid)) < 0)
60 if ((ret = H5Tclose(datatype)) < 0)
62 if ((ret = H5Aclose(attr)) < 0)