LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI built-in utility for reading/writing configuration files

All,

Does CVI have any handy built-in functions for reading/writing
configuration files for applications? My app needs to write out the
user options and then read them back in again the next time the app is
launched.

I know that LabVIEW has some nice utility functions that handle the
format of and searching of these configuration files.

Thanks,
Stephen

0 Kudos
Message 1 of 8
(5,625 Views)
Howdy Stephen,

I am going to assume you are referring to configuration .ini files.  If so, LabWindows/CVI includes a .ini instrument driver (inifile.fp) located in the <CVI>\toolslib\toolbox\ directory that contains functions for storing and accessing configuration information in INI files. Refer to the <CVI>\samples\toolbox\ini.prj shipping example for help. 

Hope this helps!

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 2 of 8
(5,615 Views)

Beware, the inifile.fp functions while good do not support traditional comments (;) because of the way this has been implemented. There is a lot to be said for using the good old API calls such as GetPrivateProfileString etc. If comments are not important then these function panel functions may well be what you want.

 

0 Kudos
Message 3 of 8
(5,596 Views)

Kevin warning is good and it must kept in mind while using this tool.

I personally prefere to use the inifile instrument since it's more friendly than other available solutions, just adding comments as separate items section by section (i.e. adding some "Comment" of "SomeItem comment" field to each section where it's needed) or simply adding a [Comments] section. Provided you read back the ini file before updating it's content all such comments are maintained.



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 4 of 8
(5,578 Views)
Hi,
 
   I'm new to CVI, and I'm trying to use the INI file utility to read in configuration data. I tried following the ini example and cutting out the necessary parts, such as the INI routines.
 
I put the "ini.h" and "inifiles.h" include statements at the top but when I compile I get a string of link errors, one for each INI function I have...
 
Please help.
 
Max
0 Kudos
Message 5 of 8
(5,168 Views)
A link error indicates that the definitions for these functions cannot be found. Those definitions are in the compiled .obj file associated with the Inifile instrument. Just add inifile.fp to your project, and you should be set.

Mert A.
National Instruments
0 Kudos
Message 6 of 8
(5,163 Views)
Also, be aware that ini.h is a file specific to the demo program for inifile.fp: in your application you only need to include inifiles.h


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 7 of 8
(5,140 Views)
Thanks. That worked. Now I can read the tag item pairs from the file, which is great.
 
Now, another dumb question...
 
So I have some loops that are going through the ini file reading the pairs, assigning each name as a char string to a variable called itemName and each value to something called *Value, where the wildcard denotes the type of variable.
 
Now how do I tell CVI to create a variable with with the string stored in itemName and the value stored in *Value?
 
Max
0 Kudos
Message 8 of 8
(5,121 Views)