|LabVIEW 2016 Help|
|LabVIEW 2017 Help|
|LabVIEW 2018 Help|
|LabVIEW 2019 Help|
|LabVIEW 2020 Help|
Windows configuration settings files are text files divided into named sections. Brackets enclose each section name. Every section name in a file must be unique. The sections contain key/value pairs separated by an equal sign (=). Within each section, every key name must be unique. The key name represents a configuration preference, and the value name represents the setting for that preference. The following example shows the arrangement of the file:
Use the following data types with Configuration File VIs for the value portion of the key parameter:
|Note LabVIEW writes Boolean values as TRUE and FALSE by default, but these values are not case sensitive. For example, False, false, and 0 are all acceptable FALSE Boolean values.|
To use the Configuration File VIs, you must format each line of text in an .ini file correctly. A line must either be empty or contain a section name, a key-value pair, or a comment.
|Note You can use the Configuration File VIs for Windows configuration settings files only in the ANSI format.|
Use the following guidelines to format lines with section names:
Use the following guidelines to format lines with key-value pairs:
|Note If values begin or end with white space characters, you must put the values in quotation marks. LabVIEW removes the quotation marks when a VI returns the value.|
Configuration File VIs ignore lines without section names or value-key pairs during a read operation, and they preserve lines without section names or value-key pairs during a write operation.
When VIs write to a configuration file, they place quotation marks around any string or path data. LabVIEW also supports single quotes around values in .ini files.
The accepted comment notation for configuration files is a semicolon, which can indicate that the text following the semicolon is a comment. A semicolon at the beginning of a line indicates a comment. A semicolon in a section name, numeric value, or Boolean value also indicates a comment. However, a semicolon in a string value name does not indicate a comment.
If you include a semicolon as the first character of a key name, LabVIEW does not return a key name or value because the configuration files do not support a semicolon as the first character of a key name. If you include a semicolon at any other place in the key name besides as the first character, LabVIEW returns the key name with the semicolon.
The following table provides examples of how the Configuration File VIs read section names in .ini files.
|Example text in .ini file||Section name|
|[ sec with spaces ]||sec with spaces|
The following table provides examples of how the Configuration File VIs read key-value pairs in .ini files.
|Example text in .ini file||Key name||Value|
|keyname = 12.3 ;comm||keyname||12.3|
|key name6=" mystring6"||key name6||mystring6|
|keyname8 = mystring8||keyname8||mystring8|
|keyname9 = " mystring9 "||keyname9||mystring9|
|#keyname13 = mystring13||#keyname13||mystring13|
|Note Because the Read Key VI is a polymorphic VI, it acts differently in certain instances. For example, for the keyname = 12.3 ;comm key-value pair, the String instance returns a string value of 12.3;comm and the Double instance returns a numeric of 12.3 for the value output.|
The Configuration File VIs can read and write raw or escaped string data. The VIs read and write raw data byte-for-byte, without converting the data to ASCII. In converted, or escaped, strings LabVIEW stores any non-displayable text characters in the configuration settings file with the equivalent hexadecimal escape codes, such as \0D for a carriage return. In addition, LabVIEW stores backslash characters in the configuration settings file as double backslashes, such as \\ for \. Set the read raw string? or write raw string? inputs of the Configuration File VIs to TRUE for raw data and to FALSE for escaped data.
In configuration settings files, LabVIEW stores path data in the standard Linux format for paths. The VIs interpret the absolute path /c/temp/data.dat stored in a configuration settings file as follows:
The VIs interpret the relative path temp/data.dat as follows: