LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write comments in configuration file in labview 8.6.1

I want add comment in my configuration file with extension .ini in any section that shows the purpose of that section. 
0 Kudos
Message 1 of 3
(5,136 Views)

Although this is the LabWindows/CVI message board, not the LabView one, the conventional way to insert comments into an .ini file is to start the comment line with a semi-colon.

 

JR

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

As far as I know, LabView doesn't have anything specific to writing comments to ini files.  LabView's Configuration Files VI Open Config Data, Read Key, Write Key, and Close Config Data don't have options to write comments.

 

I think what you need to do is to create your ini file, call Close Config Data VI with the write configuration file? input set to TRUE, and then write your own VI to add the comments as follows:

Open the ini file as a text file.

Open a temporary text file for output.

Read your ini file one line at a time, writing each of the lines to your temporary file until you find the section of interest.  Then write your comments.

Then continue to the end of the ini file.

Then close both files and copy the temporary file over the original ini file.

 

You could use a 2D string array as the input to your VI to add comments.  One column of the 2D array could be the section name.  The second column could be the comment you want to add.

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