LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I create a new "Section" in an Ini file dynamically?

I need to create/add a new section at run time to an existing ini file and I was wondering what the best way to do this is?
0 Kudos
Message 1 of 3
(3,529 Views)
Supposing you are using the inifile instrument that comes with CVI, you have simply to write the desired items of the new section, and it will be automatically created.
The procedure is this one:
1. Create an IniText object (Ini_New function)
2. Read the previous content of the .ini file (Ini_ReadFromFile function) in order to preserve it
3. Write the items in the new section (Ini_Put functions in which to indicate the new section name)
4. Save the file with Ini_WriteToFile function
And that's all.

Hope to have helped a little
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(3,529 Views)
I would like to note that the INI file instrument driver mentioned is available by going to Instrument >> Load >> \toolslib\toolbox\inifile.fp.

Jeremiah Cox
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 3 of 3
(3,529 Views)