LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

INI File Section inside Section

Solved!
Go to solution

Hi,

 

I was wondering if it's possible to read from an ini file with multiple sections, for example:

 

[SECTION1]

 [SECTION1-1]

  Val = 1

[SECTION2]

 [SECTION2-1]

  Val = 2

[SECTION2-2]

  Val = 3

 

Is it possible to use Ini_GetInt ( ); to get Val = 2....

As it seems the function get to the section a string so I don't know how to do it....

In other places like C++ I can use SECTION1.SECTION1-1 any one has an idea ?

-----------------------------------------
Kobi Kalif
Software Engineer

0 Kudos
Message 1 of 2
(20,030 Views)
Solution
Accepted by topic author Kobi_K

Ini files in CVI do not permit subsections, so a structure like yours could not be read.

 

As an alternative you could consider to move to XML format, which is more flexible and permits nesting sections.

 

Another alternative could be to format section titles in the format [Section1 - Subsection1] of format item labels with the style "Subsection - ItemName". In the first case your file will result in

[SECTION1]
Item = "Test"
Subsections = 1 [SECTION1-SUBSECTION1] Val = 1 [SECTION2] Item = "Test"
Subsections = 2 [SECTION2-SUBSECTION1] Val = 2 [SECTION2-SUBSECTION2] Val = 3

 In the latter case you will have:

[SECTION1]
Item = "Test"
Subsections = 1 SS1 - Val = 1 [SECTION2] Item = "Test"
Subsections = 2 SS1 - Val = 2 SS2 - Val = 3

 

I have used both and personally find the last one more intuitive both in reading and in programming.

 

 



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?
Message 2 of 2
(20,029 Views)