Reading a comment_struct from an opened .h5 file

First thing to do is to query the size of the comment string array and the stringlength so that we can allocate memory. Again, don't forget to call dm_clear_comments.
if (dm_h5_read_comments_info(h5_file_id,&n_strings,&string_length,
 			 			   error_string) != DM_FILEIO_SUCCESS) {
     printf("%s\n",error_string);
     dm_h5_close(h5_file_id);
     exit(1);
   }
my_comment_struct.n_strings_max = n_strings;
my_comment_struct.string_length = string_length;

my_comment_struct.string_array = 
      (char *)malloc(my_comment_struct.n_strings_max*
			     my_comment_struct.string_length);
my_comment_struct.specimen_name = 
      (char *)malloc(my_comment_struct.string_length);
my_comment_struct.collection_date = 
      (char *)malloc(my_comment_struct.string_length);

dm_clear_comments(&my_comment_struct);
Now we can read the actual comments.
if (dm_h5_read_comments(h5_file_id,&my_comment_struct,
		    			   error_string) != DM_FILEIO_SUCCESS) {
     printf("%s\n",error_string);
     dm_h5_close(h5_file_id);
     exit(1);
   }



Microscope User 2008-11-25