LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

save class as config file format

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

 

 

CLAD / Labview 2011, Win Xp
------------------------------------------------------
Mission d'une semaine- à plusieurs mois laissez moi un MP...
RP et Midi-pyrénées .Km+++ si possibilité de télétravail

Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
Don't forget to valid a good answer / pensez à valider une réponse correcte
0 Kudos
Message 1 of 5
(3,264 Views)

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.

    Benjamin R.


Senior LabVIEW Developer @Neosoft


0 Kudos
Message 2 of 5
(3,246 Views)

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.

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 3 of 5
(3,231 Views)

I have implemented a simple project in LV 2010.

    Benjamin R.


Senior LabVIEW Developer @Neosoft


Message 4 of 5
(3,226 Views)

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>

Thoric (CLA, CLED, CTD and LabVIEW Champion)


Message 5 of 5
(3,215 Views)