LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Ini File KEYS and Respective VALUES Deleted

Solved!
Go to solution

Hello:

 

I use LabVIEW ini file read/write functions at various places. 

I have this [Main] section where most things get written-to and read-from. 

At some point, however, a bunch of KEYS and their respective VALUES get mysteriously WIPED OUT (DELETED). 

I have hunted for a process that does this to no avail. 

Does anyone know how this can happen? 

When this happens other Keys remain. The truncation happens from a specific Key downwards. 

0 Kudos
Message 1 of 11
(228 Views)

Hi Anthony,

 


@Anthony_L wrote:

When this happens other Keys remain. The truncation happens from a specific Key downwards. 


What is this "specific" key?

 

Can you replicate the behaviour with a small test VI?

Are there additional comment lines in your INI file? (Lines with semicolon at the start…)

Are there non-ASCII chars in the INI file? (ASCII is defined as 7-bit values from 0x00 to 0x7F!)

Any non-readable chars other than "usual" (TAB, LF, CR, Space)?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(213 Views)

Without seeing any code we can only speculate, but from your description:

You read the file in many places, maybe remember in a control (bad design) or shift register (then, why have several). You then add and write back from several places, each overwriting the previous change thus "removing" keys.

Sound about right?

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 11
(195 Views)

Hello Gerd:

 

Thank you for taking time to look at my issue. I am at the beggining stages of troubleshooting this issue. 

what happens is as if when a certain set of keys is written, it reSETS the file to have only those keys. 

All keys have simple ASCII strings. 

I am wondering about the TRUE default boolean on this INI CLOSE File VI. 

will that RESET things? 

I will continue troubleshooting and will report back further findings. 

 

0 Kudos
Message 4 of 11
(186 Views)

Thank you Yamaeda: 

 

For taking time to review my issue. For example: Does it mean that if I have 15-keys, 

 

Then if one process writes 5 keys does it mean that 10 keys will be deleted?

I am wondering if this is what us happening.’

 

for example what does boolean true do here?

0 Kudos
Message 5 of 11
(183 Views)
Solution
Accepted by topic author Anthony_L

Hi Anthony,

 


@Anthony_L wrote:

For taking time to review my issue. For example: Does it mean that if I have 15-keys, 

 

Then if one process writes 5 keys does it mean that 10 keys will be deleted?

I am wondering if this is what us happening.’


The INI file functions internally buffer the keys. So you should not open the same INI file more than once in your app otherwise you create a race condition!

 


@Anthony_L wrote:

for example what does boolean true do here?


It will do what the help says: write the INI file when a key has changed…

 

You don't need to create two messages to answer. And you don't need to attach the same image twice…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 11
(180 Views)

Have you accidentally used the "Remove Section" VI? 

aputman_0-1739908923965.png

 

aputman
0 Kudos
Message 7 of 11
(148 Views)

The reference wire for a .ini file isn't a real reference.  It actually contains the contents of the file.

If you have forked that wire, that would account for the behavior.

0 Kudos
Message 8 of 11
(130 Views)

No I did not.

 

Looks like it was caused by a race condition as Gerd pointed out.

0 Kudos
Message 9 of 11
(118 Views)

True!

 

A parallel same ini file read/write process was causing it.

0 Kudos
Message 10 of 11
(116 Views)