LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Formatting pathname and filename correctly to call external app.

I'm trying to launch an external application that takes in a filename as a parameter.
I'm using FileSelectPopup to let the user select a file.
This returns a filename in the form of: "C:\proj\compose\images\blank.bmp" with single backslash.

Then I try to use LaunchExecutable or system() to launch an application that takes the selected file as a parameter; except that these two function need the path\file in the form of:

"C:\\proj\\compose.exe C:\\proj\\compose\\images\\blank.bmp" with double backslash.

How do I format my variable after FileSelectPopup correctly?

Thanks.
0 Kudos
Message 1 of 3
(3,001 Views)
Since the slash is already in a variable and not in a string constant, I don't think you need to double-slash it.
See my note and sample code here (reply 5 of 7).
The compiler tries to interpret a backslash in a string constant as a backslash code rather than a backslash character. But the backslash in a string is the backslash character.
0 Kudos
Message 2 of 3
(2,995 Views)
Thanks Al S. Yeah, I'm sure I have to double slash. I have to use the single slash for the picture control and double slash for the LaunchExecutable call... couldn't find a way around it.

Anyway, I used your suggestion, it's working. Thank you.
0 Kudos
Message 3 of 3
(2,975 Views)