// // C++ Implementation: test_append_sds // // Description: // // // Author: Nicolas PASCAL , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "Hdf_file.hpp" #include using namespace std; int main(int argc, char* argv[]) { string file = "/home/pascal/test/my_file.hdf"; // --- init the file to write Hdf_file* hdf_file = new Hdf_file ( file.c_str(), DFACC_CREATE ); // --- create an sds to write // set SDS data buffer int32 sds_data_1[] = { 1, 2, 3, 4, 5 }; // set sds infos Hdf_sds::sds_infos_type sds_infos; char sds_name_1[] = "SDS_1"; sds_infos.sds_name = sds_name_1; sds_infos.sds_type = DFNT_INT32; sds_infos.sds_rank = 1; int32 sds_dims_1[] = { 5 }; sds_infos.sds_dimensions = sds_dims_1; sds_infos.sds_cal = 10.; sds_infos.sds_cal_err = 0.; sds_infos.sds_offset = 55.; sds_infos.sds_offset_err = 25.; sds_infos.sds_nattrs = 0; // write the SDS hdf_file -> append_sds ( sds_infos, sds_data_1 ); // --- close file delete hdf_file; return 0; }