07-20-2011 11:24 AM
hello,
i trying to save class as config.ini file little bit like saving class in xml format , is there a way to do that ?
Regards
Tinnitus
07-21-2011 02:17 AM
Hi Tinnitus,
Thanks for posting on National Instruments forum.
You need to use Flatten to string and Unflatten from String function to be able to write your LVClass in a config file.
07-21-2011 06:58 AM
A class is a dynamic object and requires an advanced markup language in order to be exported to a human-readable file. XML is such as language and can support containment of class data. Configuration (.ini) files cannot. Flattening a class to a string will simply return a binary blob which, when saved in a config file, will likely corrupt the configuration file intergrity. It would first need to be 'escaped' to remove unsupported characters, but I'm not aware of any LabVIEW functions other than the XML based ones.
07-21-2011 07:15 AM
I have implemented a simple project in LV 2010.
07-21-2011 07:43 AM
I see now that the config file function for saving the flattened class actually escapes the characters itself (the Write Raw String? input is set to False). This is useful, but still doesn't provide you with a sensible structure for the class. The exported string is virtually uninterpretable, and the nature of a configuration file is to be human-readable.
Flattened class as escaped string:
"\00\00\00\01\0E\0CTest.lvclass\00\00\00\01\00\00\00\00\00\01\00\00\00\10@$\00\00\00\00\00\00\00\00\00\04Test"
The XML option provides a more sensible (if much longer) output:
<Object>
<Name>Test en sortie</Name>
<NumLevels>1</NumLevels>
<Class>Test.lvclass</Class>
<Version>1.0.0.1</Version>
<Cluster>
<Name>Test.lvclass</Name>
<NumElts>2</NumElts>
<DBL>
<Name>Number</Name>
<Val>10.00000000000000</Val>
</DBL>
<String>
<Name>String</Name>
<Val>Test</Val>
</String>
</Cluster>
</Object>