I'm trying to convert my *.h5 file to *.txt in my C++ program.
My file is of the hierarchical data type. My program needs to be able to convert the dataset portion (or the whole file) of the file to a text file in the same manner an "h5dump" command converts it in the terminal.
I tried typing
h5dump -o fileout.txt -y -w 35 filein.h5
in the C++ code, but it didn't work. (That is the exact command that works in the terminal.) Is there a C++ command that would take this line of code and use the terminal to execute it, or a different C++ command that would do the same thing?
You can use fork() and exec() system calls to create a child process and exec the h5dump in the child. Or, simpler but less safe and not recommended is to use the system() function.