LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

string to path conversion problem with colon

Hi Folks:

I am converting a string that has an instance of a colon (:) to path. In this conversion process, a backslash gets inserted before the colon due to the fact I am sure that the colon denotes some sort of special character / token. I can substitute a dash for the colon which will solve my problem but what do I need to do if I want to keep the colon? I am sure this has come up before and there is a pretty easy solution. Any help is appreciated.

Sincerely,

Don
0 Kudos
Message 1 of 5
(3,414 Views)
Hi Don

I was not able to have a look at your vi because I don't use LV7.1.

But try to generate the whole path in the string (for example: C:\testdir\test:testdir\file.txt). Now convert this string to a path.
I just tried it and it worked.

Hope this helps.

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 5
(3,404 Views)
I took your example and just prepended a c:\ to the front and this takes care of the problem
0 Kudos
Message 3 of 5
(3,403 Views)
Hello gold,

some characters are forbidden to use in filenames (or paths). And these characters can be (or are) different from OS to OS.

For Windows forbidden characters are: \ / : * ? " < > | (found in Windows help...)
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(3,400 Views)
I think what is happening is that the 'string-to-path' function automatically looks for colon and if does not also see backslash, it inserts it. This is no good for me for how how I devised building the path so I will have to modify my strategy. It is beyond the scope of this post why I wanted to do it the way that I was doing it.

Sincerely,

Don
0 Kudos
Message 5 of 5
(3,386 Views)