writing attributes to a fileid?

NOTE: The netcdf-hdf mailing list is no longer active. The list archives are made available for historical reasons.

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


  • 2005 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-hdf archives: