08-16-2015 03:03 AM
I am trying to dump a series of refnum's to string as part of my error reporting system for a LabVIEW program that is interfacing with a .NET DLL.
I have tried typecasting, flatten to string and a few other things. They do provide output but it isn't a number it is a couple of characters (which don't seem to display when I tried to put them into this post).
I am guessing that I have a number in binary format that is mapping to non printable characters.
Is there any way to get a refnum to display as an actual number the same way it appears when you put a probe on it and are stepping thru code?
many thanks
David
Solved! Go to Solution.
08-16-2015 04:53 AM
Type cast to a U32, then convert that to a string. Note that the only value a refnum will give you is to see whether or not you're operating on the same reference in more than one place, because the numeric value itself is meaningless and a new numeric value is assigned each time the reference is created.
08-16-2015 05:03 AM
What kind of Refnum is it? It will be great if you post your code.
08-16-2015 07:11 AM - edited 08-16-2015 07:21 AM
Thank you for the help.
I Tried setting the numeric typecast to U32 but that does't work. I still get unprintable characters.
I have attached a picture of the VI. , The VI and dll are in the zip file.
I understand the actual numbers are meaningless and really only want to be able to dump numbers in the event of an error as the library I am using needs me to open alot of references and this is an easy way to ensure:
1) References are correctly closed (also because some references have to be closed and disposed because of how the .NET dll has been programmed apparently). Once closed properly the reference becomes zero so this can be tested.
2) As you say I can then make sure my renums aren't getting crossed over because there are going to be a few of them.
The posted VI is just my test VI for a basic sftp file get. The project is an LVOOP library that talks to the Renci SSH code and should hopefully provide VI's for SFTP, SCP, SSH and port forwarding.
08-16-2015 09:34 AM
Typecast as U32 and then convert to string isn't the same as typecast as U32 and then typecast as string.
The first will cast the refnum into a series of characters and then create a string with those characters. The second means convert the refnum into a series of characters and then use them in pairs to create ASCII characters (the unreadable mess you're getting).
Do you have access to the Desktop Execution Trace Toolkit? http://sine.ni.com/nips/cds/view/p/lang/en/nid/209044 That has the means to watch your open refnums as well.
08-16-2015 12:02 PM
Instead of using the Type Cast to convert your number, use the Number To Decimal String.
08-16-2015 08:14 PM
Fantastic,
Thank you for all your help.
Basically the "Type Cast" to U32 followed by a "Number to String" works well.
I have opted to use Number to Hexadecimal String simply because it is more obvious what the number represents and winds up as less digits.
I can now fix up my error handling. 🙂