e***@gmail.com
2014-10-04 23:33:42 UTC
I'm updating an application and cannot remember how to escape the "\"
character in strings. Previously I used MSVS2010 and I am now using
MSVS2012. With 2010, when I drop one or more files on my application I get
an array of one or more names which looked vaguely like:
"H:\Music\Test.wav"
with 2012 the same file drop name would look like:
"H:\\Music\\Test.wav"
note that in the 2012 version of the file name which is passed from the
operating system we now have 2 backslashes. However, when I pass this
string to the file opening function I get an Assert & Exception. If I pass
the original string, everything works just fine. It would not surprise me
if this is a bug in the very old library I'm forced to use to open these
files. What I need to know is how to escape the backslashes so that I can
do something that looks like:
wxString name = wxT("H:\\Music\\Test.wav "); size_t done =
name.Replace(wxT("\\"), wxT("\")); I tried:
size_t done = name.Replace(wxT("\\\\"), wxT("\\")); but, while it compiled,
it failed to do the job.
character in strings. Previously I used MSVS2010 and I am now using
MSVS2012. With 2010, when I drop one or more files on my application I get
an array of one or more names which looked vaguely like:
"H:\Music\Test.wav"
with 2012 the same file drop name would look like:
"H:\\Music\\Test.wav"
note that in the 2012 version of the file name which is passed from the
operating system we now have 2 backslashes. However, when I pass this
string to the file opening function I get an Assert & Exception. If I pass
the original string, everything works just fine. It would not surprise me
if this is a bug in the very old library I'm forced to use to open these
files. What I need to know is how to escape the backslashes so that I can
do something that looks like:
wxString name = wxT("H:\\Music\\Test.wav "); size_t done =
name.Replace(wxT("\\"), wxT("\")); I tried:
size_t done = name.Replace(wxT("\\\\"), wxT("\\")); but, while it compiled,
it failed to do the job.
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users