LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a sizeof function for a cluster?

I already did a search for this question, but I didn't get the answer I need. I know I'm suppose to do a typecast. What do I typecast it to? What do I use to read the size of the cluster I got?

For more details, I read in an element which is a cluster using binary read. The binary file has multiple clusters with the same size. The cluster has a bool and an large array or data with unknown size. I'm trying to determine the size of the cluster inorder to determine the number of bytes  I need to skip. Thanks.


Message Edited by d1sturbanc3 on 03-12-2008 08:53 AM
0 Kudos
Message 1 of 5
(2,781 Views)
I'm a tad confused. If you're reading the cluster from a file aren't you already "skipping" the bytes? Is the array of a fixed size? Once you read the array from file the Get File Position function will return to you where the file pointer is, so you know how many bytes you've read.
0 Kudos
Message 2 of 5
(2,773 Views)
To follow-up: You can use the Flatten To String to get the "size" of something. Note that this function has a prepend array or string size? input, so you need to match this to how you wrote out the data to file.




Message Edited by smercurio_fc on 03-12-2008 09:00 AM
0 Kudos
Message 3 of 5
(2,768 Views)
I'm still a bit confused.
I wrote out a cluster which contains an array (It's an waveform). I keep on appending the file with the cluster which contains the same size of array.

Now I'm trying to read it back in. But instead of reading it from the beginning, I want it to start a specific cluster. I have already determined how many clusters I want to skip. Inorder to skip, the read to needs to know how many bytes to skip.

To determine the number of bytes I need to skip, I read in one of the clusters. So If I use flatten to string, should that provide the number of bytes one of these clusters will take up?

Thanks.
0 Kudos
Message 4 of 5
(2,756 Views)
You would need to set the file position based on the size of the cluster, offset by 4 if you're prepending the size of the array. See attached for a simple example (8.2).


Message Edited by smercurio_fc on 03-12-2008 09:50 AM
0 Kudos
Message 5 of 5
(2,743 Views)