HDFql strange characters randomly from select command


Hi, new to HDF, and I found HDFql and got setup on that with the C# wrapper on Visual Studio 2013.

I just need to read some data from an existing HDF5 file and write some data values (repeatedly). I can open the file with HDFView and see the structure and types and data just fine.

The particular dataset I need to read has just a single string of length 68. It should look like this:

When I execute a SELECT command and then use the (sub)cursor to walk through the char array and concatenate the string, I sometimes get the correct string, but sometimes I get something like this:

And sometimes it is really bad:
“169æœÇ.2íÃr\t5æœÇ4.168.8èœå1~eœppÝpäÊ\r6NP\b\byrÿÿÿøeœöÊ6”UocaÊ6mèœè_IÊ&6I‰ËIéœî_Ðp!\aHR~2Ê60„20Ê:6ÄçœØÊ965ëÃrøeœÞÊ76I79~SpÊX6„\viÊV6ric„úogæ”ëpÞßì™\fn.Soeœ– urce„ü.PyÊN6rÊd6ocÊr6ø\fa„ým.IV.dl„ûl”

One other odd one I got was this (just note the extra “DFql” on the end):

Each time I run the same code on the same file, I get a different result. I also used HDFql.SubcursorGetCount(), and it returns 68 every time, regardless of the extra junk. I ruled out my parsing of the char array by doing it a few times in a row and comparing the results, which were always identical.(good or bad) Repeating the execution of the SELECT command, however, gives different results for each.

My command isn’t complex, just HDFql.Execute(“SELECT FROM …”)
After that I set the cursor to first and subcursor to first, and loop through the characters, moving the subcursor to next, until I hit a null.
Otherwise just use and close the file at the beginning and end.

Any ideas what could be causing these strange characters, and why is it randomly good or bad? And what to do about it?

Thank you.


Hi Daniel,

Thanks for reporting this.

Would it be possible to send the HDF5 file (or eventually have it available in the cloud for download), as well as the HDFql C# code that reads that particular dataset? With this info, we will be able to better debug the issue you are facing.



Apparently new users aren’t allowed to upload. Here’s cloud links:

Please let me know if these don’t work, haven’t used ZippyShare before.

I copied the essential code into a .txt file (easiest way to remove proprietary information). I was using VS2013 Update 5, C# .NET 4.5, and I had compiled the three wrapper .cs files provided by HDFql into a .dll and referenced that in my project. Hopefully that should be sufficient to recreate it.



Thanks for sharing these files @daniel.meier!

It seems that there is an issue with method HDFql.SubcursorGetChar(). As a workaround, please use method HDFql.SubcursorGetUnsignedTinyInt() until we fix this.

To have your C# program working correctly, method GetHDFqlString() should look like the following:

private static string GetHDFqlString()
	string result = string.Empty;

	while (HDFql.SubcursorNext() == HDFql.Success)
		result += (char) HDFql.SubcursorGetUnsignedTinyInt();

	return result;

In addition, be aware that concatenating an immutable string the way you do in GetHDFqlString() may lead to poor performance. Better to use C# StringBuilder for that purpose.


Thank you! That seems to work for me. Also used StringBuilder, thanks.


Great to know that it works!