Click to See Complete Forum and Search --> : Problem with String


hoagers34
December 18th, 2006, 02:24 PM
I created a shell context menu and when a user clicks on a file, it will launch my program and it passes a commandline parameter of the file name.

I want my program to be able to open the file, but the problem is that the commandline parameter is not formatted correctly...

I am receiving "C:\test.txt" and it should be "C:\\test.txt". If i try to pass the commandline to File->Open...it fails. But if i pass C:\\test.txt it will open fine...what gives?

Is there a simple way to convert the parameter to the proper format???

martho
December 21st, 2006, 09:52 AM
You know that
String ^s = "C:\\test.txt" results in s to be "C:\test.txt", because the "\" escapes the next character?

Are you sure you are receiving "C:\test.txt" and no special chars for example which could make File->Open failt? Whats the error-message it fails with?

hoagers34
December 21st, 2006, 03:10 PM
Thanks for your response...I was not properly receiving the "\\" from the command line.