David Wisti Posted November 1, 2005 Report Share Posted November 1, 2005 Anyone notice the new terminals on "Flatten to String" & "Unflatten from String"? Finally, I can get rid of all that byte swapping and array length code in my TCP communication applications. Incase you can't find the functions, Data manipulation is now a sub-palette of Numeric. prepend array or string size? indicates whether LabVIEW includes data size information at the beginning of data string when anything is an array or string. If prepend array or string size? is FALSE, LabVIEW does not include the size information. The default is TRUE. prepend array or string size? only controls the top-level data size information. Arrays and strings in hierarchical data types such as clusters always include size information. byte order sets the endian format of the data in the resulting flattened string. Byte order, or endian form, indicates whether integers are represented in memory from most significant byte to least significant byte or vice versa. Quote Link to comment
m3nth Posted November 1, 2005 Report Share Posted November 1, 2005 Yeah I noticed them... unfortunately it means re-doing a lot of my code :headbang: Has anyone found a workaround for trying to unflatten a null string into a cluster datatype so the cluster is empty? The unflatten function now yields error 42 (generic error), which I suppose can be ignored, but that may be a bit cumbersome. Quote Link to comment
Ton Plomp Posted November 2, 2005 Report Share Posted November 2, 2005 Yeah I noticed them... unfortunately it means re-doing a lot of my code :headbang: Has anyone found a workaround for trying to unflatten a null string into a cluster datatype so the cluster is empty? The unflatten function now yields error 42 (generic error), which I suppose can be ignored, but that may be a bit cumbersome. What do you mean by a null-string? A zero length string? And what type of cluster do you have. Does it include a string (where length information is stored with the data) Success Ton Quote Link to comment
m3nth Posted January 29, 2006 Report Share Posted January 29, 2006 What do you mean by a null-string? A zero length string?And what type of cluster do you have. Does it include a string (where length information is stored with the data) Success Ton Yes, a null string meaning the zero-length string constant (shown as a little square quote) located on the palette. I have all types of cluster, usually just different data, and usually not including a string where length information is stored with the data Quote Link to comment
Jim Kring Posted January 29, 2006 Report Share Posted January 29, 2006 Yes, a null string meaning the zero-length string constant (shown as a little square quote) located on the palette.I have all types of cluster, usually just different data, and usually not including a string where length information is stored with the data The fact that Unflatten From String returns an error when you try to unflatten an empty string into a cluster is good -- this is a feature. If you use Flatten To String to flatten an "empty" cluster, you will not get an empty string (since even a cluster with default/null vales still has data). If you want a different behavior, then test for an empty string and then pass an empty cluster out. Also, the term "null", used in the context of string data, usually refers to the character whos decimal value is 0. This will appear as \00, in slash code mode. You will find that if you flatten an "empty" cluster, you will get a lot of null characters in your string data. Cheers, Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.