HDF5-LITE

For those who are familiar with IO programming, could you please tell me what is wrong with my code (I am in fact unable to write the dataset in the *.h5 file).

// DEFINE HDF5 VARIABLE1
hid_t file_test_id,string_dset;
hsize_t dimsfb[1];
herr_t status;

int FILE_LEN=100;
int LINE_LEN=100;
int fl_map_tmp=0;

char buf_test[FILE_LEN][LINE_LEN];
float buf_test2[FILE_LEN];

// GET EACH LINE OF THE TEST FILE (test_file), CONVERT INTO FLOAT, STORE IN buf_test2
// THE FILE TEST HAS BEEN PREVIOUSLY OPEN
// THIS IS WORKING
while ((fl_map_tmp < FILE_LEN) && (fgets(buf_test[fl_map_tmp],LINE_LEN,test_file) != NULL)) {

buf_test2[fl_map_tmp]= atof(buf_test[fl_map_tmp]);
++fl_map_tmp;
}
fl_map=fl_map_tmp;
fl_map_tmp=0;
fclose(test_file);
// }

// OPEN THE .h5 FILE
file_test_id = H5Fcreate("file.h5", H5F_ACC_TRUNC,H5P_DEFAULT, H5P_DEFAULT);

// CREATE THE DATASET
dimsfb[0] = FILE_LEN ;

string_dset = H5LTmake_dataset_float(file_test_id,"dataset",1,dimsfb,buf_test2);

return;


B.
Topic archived. No new replies allowed.