01-06-2005 12:41 PM
01-06-2005 12:41 PM
01-06-2005 12:52 PM
01-06-2005 12:59 PM
@rolfk wrote:
@pawel wrote:
> That is correct, but still you can recover the information
> if you know what to expect.
Well theoretically for one string or array indeed, but that is a very
cumbersome work. LabVIEW would have to parse the bytestream both from
beginning and end at the same time to get that information, a lot of
work to do for a Typecast which by definition is more or less a NOP at
runtime (LabVIEW does do some boundary checks on the string possibly
padding strings which are to short to be converted in the desired
datatype, but that is about it)! Also it is even more counterintuitive
that this function would work for clusters with one string but not for
clusters with two strings.
> E.g. your cluster can look like {U32, U32, String1, String2}, where
> you define that the first two U32 tels about the length of String1
> and String2. That would be propably most often meet during the network
> communication and some generic typedefs.
But that is exactly what "Flatten to String" is for!! With that, for
your hypothetical cluster with two strings you do not even need to fill
in any extra integers anywhere which you would have to fill in manually
as well. Flatten to string will simply create a bytestream for you in
the folliwing manner:
int32, string1, int32, string2
and the best of it all "Unflatten from String" will simply return this
back into a proper LabVIEW cluster again.
Rolf Kalbermatter
01-06-2005 01:41 PM
01-07-2005 01:35 AM
01-07-2005 09:50 AM
01-07-2005 10:10 AM