LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

refnum to string

Solved!
Go to solution

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

0 Kudos
Message 1 of 7
(7,658 Views)

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.


___________________
Try to take over the world!
Message 2 of 7
(7,618 Views)

What kind of Refnum is it? It will be great if you post your code. 


0 Kudos
Message 3 of 7
(7,605 Views)

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.

 

Download All
0 Kudos
Message 4 of 7
(7,553 Views)

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.

Message 5 of 7
(7,464 Views)
Solution
Accepted by topic author dpnsw

Instead of using the Type Cast to convert your number, use the Number To Decimal String.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 7
(7,366 Views)

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. 🙂

0 Kudos
Message 7 of 7
(7,209 Views)