String evaluation bug
metadata:
file_name: { type: array, subtype: char, size: 32 }
plugins:
decl_hdf5:
- file: ${file_name}.h5
...
sprintf(file_name, "%s", "example");
PDI_expose("file_name", file_name, PDI_OUT);
The expression ${file_name}.h5
evaluates to example
not example.h5
. The reason is that, the sprintf
adds \0
char at the end of const char*
string and the Expression puts to evaluated string: example\0.h5
. Then the H5Fopen
reads it as a const char*
string (stops at \0
).