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: 

anybody knoes hot to use the function Ini_WriteGeneric?

i need to write to a ini file but without deleting the old content of the file, this is why i can't use the simple function writetofile..instead i need to use Ini_WriteGeneric to write to a generic output but i can't figure out how it works...does anybody has an idea or example? .Regards.
0 Kudos
Message 1 of 4
(2,946 Views)
If you don't want to delete the previous content of the file, it's enough that you call Ini_ReadFromFile at the beginning of your function, then use Ini_Put functions to fill or replace the desired items and last use Ini_WriteToFile to save to disk.
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 4
(2,946 Views)

Hi Roberto,

 

And what if I do want to replace the content instead of writing the new info at the end of the file?

I have tried not using Ini_ReadFromFile but it is mandatory before reading any info inside the ini file...

 

Thanks

0 Kudos
Message 3 of 4
(2,541 Views)

The procedure remains the same: Ini_ReadFromFile, Ini_PutXX, Ini_WriteToFile.

If the values you manipulate with Ini_Put lines already exist in the file, old content is overwritten with the new one. Non existent values are added in memory. Ini_Write saves the entire memory content to file, keeping new values added inside the section you had added them to: the file on disk is entirely rewritten to reflect the content of the IniText object.



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 4 of 4
(2,537 Views)