Im trying to enter a double value in the same hdf5 databse. It consist (for now) of 1 dataset which I extend before entering a new value. That is because I am simulating a model and want to record > 100000 entries. That works well, the extending part too, but I do not understand a part of the writing. My code for writing an entry:
double pizza[1] = {7.0};
status = H5Dwrite (dataset, H5T_NATIVE_DOUBLE, memspace, filespace,H5P_DEFAULT, pizza);
With dataset, memspace, and filespace correct variables for the corresponding argument (taken from here). But why should the last argument be a predefined list? When I try to enter 7.0 directly
status = H5Dwrite (dataset, H5T_NATIVE_DOUBLE, memspace, filespace,H5P_DEFAULT, {7.0});
like this or this:
status = H5Dwrite (dataset, H5T_NATIVE_DOUBLE, memspace, filespace,H5P_DEFAULT, 7.0);
it gives an error:
error: cannot convert ‘double’ to ‘const void*’ for argument ‘’ to ‘herr_t H5Dwrite(hid_t, hid_t, hid_t, hid_t, hid_t, const void*)’ = H5Dwrite (dataset, H5T_NATIVE_DOUBLE, memspace, filespace,H5P_DEFAULT, 7.0);
And in the second case:
error: cannot convert ‘<brace-enclosed initializer list>’ to ‘const void*’ for argument ‘6’ to ‘herr_t H5Dwrite(hid_t, hid_t, hid_t, hid_t, hid_t, const void*)’H5Dwrite (dataset, H5T_NATIVE_DOUBLE, memspace, filespace,H5P_DEFAULT, {7.0});
Why is a list different then a single value, even when surrounded by brackets?