LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I add comments to a Configuration File?

If so, how?

I want to be able to update the values in the file. At the moment I have lines beginning with a semi colon and am reading from the configuration file, but as soon as I enable writing to the file it gets messed up (="" added to the end of every comment line, header information deleted).

Thanks

Richard.
0 Kudos
Message 1 of 3
(4,289 Views)
Richard;

A suggestion can be to add a comment string as a key for each section in the config file.

As far as I know there is no symbol to indicate comments, at least for a fully platform independent configuration file. Some systems use the exclamation symbol "!".

Another alternative is to use a different format, such as XML, if that's possible for your specific application.

Regards;
Enrique
www.vartortech.com
Message 2 of 3
(4,280 Views)

Begin and end each comment line with "\\" characters.  Extra carriage return\line feed characters are allowed (to improve readability).  I have only tried this on Windows XP so I don't know if it will work on other platforms.

 

Here is an example configuration file:

 

 

 

[Button1]
Text=Production Testing
Privileges=Operator,Technician,Admin
VI Path=C:\\C4Test\\Strider\\software\\labview\\Production Testing.vi

 

[Button2]
Text=Advanced Testing
Privileges=Technician,Admin
VI Path=C:\\C4Test\\Strider\\software\\labview\\Advanced Testing.vi

 

[Button3]
Text=Maintenance
Privileges=Technician,Admin
VI Path=C:\\C4Test\\Strider\\software\\labview\\Maintenance.vi

 

[Button4]
Text=Updates
Privileges=Technician,Admin
VI Path=C:\\C4Test\\Strider\\software\\labview\\Updates.vi

 

[Auxiliary1]
Text=Documents
Privileges=Operator,Technician,Admin
VI Path=C:\\C4Test\\Strider\\software\\labview\\Documents.vi

 

[Auxiliary2]
Text=Home
Privileges=Operator,Technician,Admin
VI Path=C:\\C4Test\\Strider\\software\\labview\\Home.vi

 


\\In this configuration file, square brackets enclose each section name. Every section name must be unique.\\
\\Sections contain key/value pairs separated by an equal sign. Within each section, every key name must be unique.\\
\\The key name represents a configuration preference and the value name represents the setting for that preference.\\

Message Edited by Ryan Wright on 06-16-2009 10:14 AM
Message 3 of 3
(3,980 Views)