LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why '\' cannot be recognized in the cofiguration file content using read key vi

Solved!
Go to solution
Thanks.
0 Kudos
Message 1 of 5
(3,361 Views)

I believe you need to toggle the read raw string? boolean input. Have a look at the Read Key VI Help.

 

read raw string? specifies whether the string was written without escaping unprintable and backslash (\) characters. If FALSE (default), the VI replaces any unprintable characters in the string, such as <ESC>, with a backslash and two Hex characters (\xx). If TRUE, the VI does not convert the unprintable characters in the string. 

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
Message 2 of 5
(3,360 Views)
I use default, but replaced by mass code differently each time.
0 Kudos
Message 3 of 5
(3,350 Views)

Do you mean the backslash as used in a path? eg C:\Program Files\National Instruments\LabVIEW 8.6\LabVIEW.exe

 

I had an issue with this myself, but referring to the 'Creating Configuration Files' in LabVIEW Help

 

http://zone.ni.com/reference/en-XX/help/371361E-01/lvconcepts/creating_configuration_files/

 

 

At the bottom of the page is the following:

 

 

LabVIEW stores path data in a platform-independent format, the standard Linux format for paths, in .ini files. The VIs interpret the absolute path /c/temp/data.dat stored in a configuration settings file as follows:

  • (Windows) c:\temp\data.dat
  • (Mac OS) c:temp:data.dat
  • (Linux) /c/temp/data.dat

The VIs interpret the relative path temp/data.dat as follows:

  • (Windows) temp\data.dat
  • (Mac OS) :temp:data.dat
  • (Linux) temp/data.dat

 

I know that when I wrote my ini file (in Notepad) I put in the backslashes (\). When LabVIEW read the value of the key, the backslashes (\) weren't there, and there was an error because the path (without the backslashes) wasn't recognised.

 

So using the example above, it would need to be /C/Program Files/National Instruments/LabVIEW 8.6/LabVIEW.exe

 

 

Message 4 of 5
(3,327 Views)
Solution
Accepted by topic author alex.

turbot wrote:
I use default, but replaced by mass code differently each time.

Do you mean replaced by LabVIEW? If so, the Write Key function will automatically adapt to the data type you wire to the value terminal. Write Key is polymorphic, and does not display the 'Write Raw String? (F)' option unless you right click on the function and switch from automatic to string.

 

I've attached a VI (LabVIEW 7.0) that shows examples of different ways to write and read a path to an INI.

 

Open the INI created by this VI and compare the ways the data is written and read from the file...

 

[Backslash]
PathAsString="C:\\Documents and Settings\\pbrooks\\Desktop\\Escaped Backslashes.ini"
PathAsPath="/C/Documents and Settings/pbrooks/Desktop/Escaped Backslashes.ini"
PathAsRawString="C:\Documents and Settings\pbrooks\Desktop\Escaped Backslashes.ini"

Message Edited by Phillip Brooks on 04-16-2009 07:47 AM

Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Message 5 of 5
(3,322 Views)