Example Code

Write Data to a .INI File Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview

This VI shows the user how to write information to a .ini file.

 

Description

INI is a file extension for an initialization file format as the name implies, used by Microsoft Windows. INI files are plain text (ASCII) and are used to set parameters for the operating system and some programs. Thanks to this example, users can create and modify INI file over LabVIEW.

 

Requirements

Software:

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

1. Open the .INI in Notepad.
2. Notice the values for Found, Boolean, and Variable.
3. Close Notepad.
4. Navigate to where the INI file is stored on your local disk.
5. Run the VI.
6. Open the .INI in Notepad again.
7. Notice that the values have been changed.

 

Additional Information or Resources

 

2012.png

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

National Instruments
Applications Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
scubadude
Member
Member
on

Ok, so this is an issue I've been thinking of tackleing for a while now. We have a test rig that runs the same basic test but with 5 different settings.  I see how I can read and write to an INI file. The issue I have is that I would like to be able to pull settings from an INI file modify a few of them and then save the new configutation.  Sounds simple, but the issue is that when I "read" the data from the INI, it goes into an 'indicator' box.  When I want to "write" it, it needs to be in a 'control' box.  Can one box have both functions?

crossrulz
Knight of NI Knight of NI
Knight of NI
on

Typically, you will have a VI for reading the configuration and another for writing.  And you do not have to do any reads to write.  And you can just write the few things you want changed.  Maybe you should ask your question in the forums and provide a better example of what it is you want to do.


GCentral
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
colorimeter
Member
Member
on

If you are wondering "what INI file do I open in step #1"? You need to make a blank SomeFile.ini and save it somewhere on your machine. Then use the front panel to navigate to that ini file. Then run the vi. It will have the three new flags that are mentioned in the tutorial.