LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert labview string to C-style string?

I have a labview string that is 100 characters longs. It stores a C-style, Null-terminated string, and it is only 10 characters long.  So, is there any way that I can convienently get the shorter Null-terminated string out from the long labview string, other than programatically search for the NULL character in the labview string and get the sub string?
 
0 Kudos
Message 1 of 6
(3,460 Views)

Hi LyLee,

can you upload an example of what you want?

Mike

0 Kudos
Message 2 of 6
(3,455 Views)

Isn't the whole point of a null terminated string that you have to either know the length of the string or search for the null char?

If by "programmatically" you mean "write my own code", then the answer is no - there is a primitive called Search/Split String which will do this.


___________________
Try to take over the world!
0 Kudos
Message 3 of 6
(3,411 Views)
Thanks tst! I was trying to ask if anyone knows a method without using Search/Split String...
0 Kudos
Message 4 of 6
(3,394 Views)
Well, IF you know the position of the null char, you can use String Subset, but with a string with a maximum length of 100 bytes you won't be saving any real performance and you can perform the same thing by wiring the index into the Offset input of S/SS. What's the problem with searching for the null char?

___________________
Try to take over the world!
0 Kudos
Message 5 of 6
(3,366 Views)
No problem with null at all...  Just trying to check if there is any better method I am not aware of...
0 Kudos
Message 6 of 6
(3,339 Views)