Quantcast
Channel: LabVIEW topics
Viewing all articles
Browse latest Browse all 69083

What is the "catch" in writing Variants to a Binary file?

$
0
0

I'm saving "event" data associated with an experiment that LabVIEW is "controlling".  The data includes such things as the State of several State Machines, Messages to Queued Message Handlers, digital data from hardware (such as Button Pushes), etc.  My "Event Type" is a cluster with three components -- Event Time (an I32 representing ticks of a 1KHz clock), Event ID (an Enum with values such as State, Message, Digital In), and Event Data, a Variant that is the State Enum or Message String or Digital U8 port value.

 

I wrote a test routine in which I generated some known data of Event Type, wrote it to disk using Binary Writes, then read it back in to an Array of Events doing a "Read to End-of-File" Binary Read.

 

Somewhat to my surprise, the array of Events looked exactly correct, including the Variant data.

 

What is the "catch" in storing data this way?  I can see one obvious problem -- if I change the Event ID Enum, I could mis-identify the Events.  Are there things I need to worry about in handling the Variant data?

 

[I'm now thinking about hare-brained schemes to save the Event ID data in the file, itself, perhaps as a header of some sort.  And before you ask, I'm not quite ready to think about using TDMS ...]


Viewing all articles
Browse latest Browse all 69083

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>