HDF guys,
Can I write an attribute to a fileid, instead of group id? It seems
not, though the documentation implies that I can.
For example this code doesn't work:
/* See if we can write an attribute to a fileid. */
if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,
H5P_DEFAULT)) < 0) ERR;
/* Attach a text attribute with some of Hamlet's lines. */
if ((spaceid = H5Screate(H5S_SCALAR)) < 0) ERR;
if ((typeid = H5Tcopy(H5T_C_S1)) < 0) ERR;
if (H5Tset_size(typeid, strlen(txt)) < 0) ERR;
if ((attid = H5Acreate(fileid, ATT1_NAME, typeid, spaceid,
H5P_DEFAULT)) < 0) ERR;
if (H5Awrite(attid, typeid, txt) < 0) ERR;
if (H5Aclose(attid) < 0 ||
H5Sclose(spaceid) < 0 ||
H5Tclose(typeid) < 0 ||
H5Fclose(fileid) < 0) ERR;
It fails on the H5Acreate, saying that the fileid is not an
appropriate place to define an att.
Is this intended behavior?
Thanks!
Ed
--
Ed Hartnett -- ed@xxxxxxxxxxxxxxxx