LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

deleting a section of data from an ini file (config file)

Solved!
Go to solution

Hi

 

I have a config file (ini file) which has huge data(2000 lines) which contains Sections and keys. I would like to delete a Section and keys

I am using an FGV (functional global variable). I would like to delete part of data programmatically from the file and write it back .

 Delete from array is one solution i know. Is there any best solution to use.

 

 

0 Kudos
Message 1 of 12
(7,397 Views)
Solution
Accepted by mkReddy

If you are using the Config File API that NI gives you, there are the Remove Section VI and Remove Key VI that sound like they do what you want.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 12
(7,382 Views)

Hi Reddy,

 

with the INI file functions you find a function to delete a key and a second function to delete a section.

What else do you need?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 12
(7,379 Views)
The Sound and Vibration Toolkit has the Configuration File VIs Palette has the following available: Open, Read, Write, Remove, Remove Section, Close, Get Key, Get Section, Not a Config?. If you don't have this toolkit then parse the config file by using base package VIs - Open/Create/Replace, Read from Text File and check for sections and keys. You can put them in whatever container you want (Array,Queue). If you use queues you can flush one of the elements out.
0 Kudos
Message 4 of 12
(7,371 Views)

Thank you to all...your suggestions helps me alot..:)

0 Kudos
Message 5 of 12
(7,352 Views)

@Regulator wrote:
The Sound and Vibration Toolkit has the Configuration File VIs Palette has the following available...

Actually, you do not need the Sound and Vibration Toolkit to use those VIs.  They are available in the base version of LabVIEW under the File I/O->Configuration File palette.  The SVT just adds another link to those VIs in the palette.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 12
(7,346 Views)
Sweet!
0 Kudos
Message 7 of 12
(7,333 Views)
Did we solve your issue?
0 Kudos
Message 8 of 12
(7,322 Views)

Hi ,

 

I have to delete a string in a key... they are tab delimited

 

[Devices]

Section_Name = " Lpt1 Lpt2 Lpt3 Lpt4 Lpt5 Lpt6"

 

I would like to delete Lpt3

Get result as

 

Section_Name = "Lpt1 Lpt2 Lpt4 Lpt5 Lpt6"

 

How can I get it?

0 Kudos
Message 9 of 12
(7,259 Views)
Hi,

Read the key, change the string as needed, write the key...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 12
(7,248 Views)