101 if (hdf_status ==
FAIL)
109 hdf_status =
SDend(sd_id);
110 if (hdf_status ==
FAIL)
135 int32 num_global_attrs = 0;
137 int32 attr_index = 0;
140 char **attrlist_tmp = NULL;
142 if (num_attrs == NULL || attrlist == NULL)
146 hdf_status =
SDfileinfo(sd_id, &num_datasets, &num_global_attrs);
147 if (hdf_status ==
FAIL)
151 attrlist_tmp = (
char**)calloc(num_global_attrs,
sizeof(
char**));
152 if (attrlist_tmp == NULL)
155 for (attr_index = 0; attr_index < num_global_attrs; ++attr_index)
158 hdf_status =
SDattrinfo(sd_id, attr_index, attr_name, &hdf_datatype, &count);
159 if (hdf_status ==
FAIL)
162 attrlist_tmp[attr_index] = (
char*)malloc((strlen(attr_name) + 1) *
sizeof(char));
163 if (attrlist_tmp[attr_index] == NULL)
166 strcpy(attrlist_tmp[attr_index],attr_name);
169 *attrlist = attrlist_tmp;
170 *num_attrs = num_global_attrs;
187 int32 num_global_attrs = 0;
188 int32 attr_index = 0;
189 char **attrlist_tmp = NULL;
191 if (num_attrs == NULL || attrlist == NULL)
200 attrlist_tmp = (
char**)calloc(num_global_attrs,
sizeof(
char**));
201 if (attrlist_tmp == NULL)
204 for (attr_index = 0; attr_index < num_global_attrs; ++attr_index)
211 attrlist_tmp[attr_index] = (
char*)malloc((strlen(attr_name) + 1) *
sizeof(char));
212 if (attrlist_tmp[attr_index] == NULL)
215 strcpy(attrlist_tmp[attr_index],attr_name);
218 *attrlist = attrlist_tmp;
219 *num_attrs = num_global_attrs;
HDFFCLIBAPI intf intf intf * count
MTKt_status MtkStringListFree(int strcnt, char **strlist[])
Free string list.
MTKt_status MtkFileAttrListNcid(int ncid, int *num_attrs, char **attrlist[])
MTKt_status MtkFileAttrListFid(int32 sd_id, int *num_attrs, char **attrlist[])
Version of MtkFileAttrList that takes an HDF SD file identifier rather than a filename.
MTKt_status MtkFileAttrList(const char *filename, int *num_attrs, char **attrlist[])
Get a list of file attributes.
#define MTK_ERR_CODE_JUMP(code)
EXTERNL int nc_inq_varnatts(int ncid, int varid, int *nattsp)
HDFLIBAPI int32 SDstart(const char *name, int32 accs)
HDFLIBAPI intn SDend(int32 fid)
HDFLIBAPI intn SDattrinfo(int32 id, int32 idx, char *name, int32 *nt, int32 *count)
EXTERNL int nc_inq_attname(int ncid, int varid, int attnum, char *name)
HDFLIBAPI intn SDfileinfo(int32 fid, int32 *datasets, int32 *attrs)
#define MTK_ERR_COND_JUMP(code)
MTKt_status MtkFileAttrListHDF(const char *filename, int *num_attrs, char **attrlist[])
EXTERNL int nc_close(int ncid)
MTKt_status MtkFileAttrListNC(const char *filename, int *num_attrs, char **attrlist[])
EXTERNL int nc_open(const char *path, int mode, int *ncidp)