From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

inifile : strange behaviour : CVI7

Hi,
I'm surprised to see that ReadFromFile seems to sort items for sections.For example,
[Section]
0x0B = TEST1
0x0A = Test2

If I get items one by one with Ini_NthItemName(i).The first is 0x0A not 0x0B !. So, it seems like IniFile.Fp sort the items even if I uses Ini_DisableSort(). Why ?
0 Kudos
Message 1 of 5
(3,033 Views)
I couldn't reproduce this. When you create the ini file with INI_New(0), it shouldn't auto-sort when you read. I also tested creating with Ini_New(1), then calling Ini_DisableSort() BEFORE calling Ini_ReadFromFile and it also did not auto-sort. So both code examples below, didn't sort the list in memory.

g_myInifile = Ini_New (0);
Ini_ReadFromFile (g_myInifile, g_fileName);

or

g_myInifile = Ini_New (1);
Ini_DisableSort(g_myIniFile);
Ini_ReadFromFile (g_myInifile, g_fileName);

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 5
(3,033 Views)
Thank you.

I didn't sort the inifile inside my project but you're right, in another very simple application it works fine. I will searched again what happends.
I've noticed that localui.fp automatically load inifile.fp, so it's not necessary to add it n the project.Is it true ?
0 Kudos
Message 3 of 5
(3,033 Views)
That's true. However, we provide the source code of inifile.fp (inifile.c) for you, in case you need or want to modify or debug it, so it may help to add the inifile.c file to your project so you can step through the inifile code and see what is going on.

Chris
0 Kudos
Message 4 of 5
(3,033 Views)
OK.I've found the trouble.It comes from my application.
Thank you.
0 Kudos
Message 5 of 5
(3,033 Views)