Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wchar_t*

Status
Not open for further replies.

fergmj

Programmer
Feb 21, 2001
276
US
I have a question about wchar_t*

My program doesn't compile. I get this error:

[C++ Error] Unit1.cpp(25): E2034 Cannot convert 'char *' to 'wchar_t *'

This is the line:

Edit3->Text = Mp3Enc1->Open("c:\test.wav", "c:\test.mp3");

Apparently the filenames are char. How do I get them to wchar_t*?

Thanks
 
Try this: "C:\\test.wav" and "C:\\test.mp3". Failing that, what happens if you do:
Code:
AnsiString File1 = "C:\\test.wav";
AnsiString File2 = "C:\\test.mp3";
Edit3->Text = Mp3Enc1->Open(File1, File2);
[code]? James P. Cottingham
[COLOR=blue]
I am the Unknown lead by the Unknowing.
I have done so much with so little 
for so long that I am now qualified 
to do anything with nothing.
[/color]
 
maybe just cast them to wchar_t *

Edit3->Text = Mp3Enc1->Open((wchar_t*)"c:\test.wav",(wchar_t*) "c:\test.mp3");


if your open function requires wchar_t* I don't think it will accept AnsiString as an input.



Wim Vanherp
Wim.Vanherp@belgacom.net
 
I didn't make myself very clear, sorry. Anytime you use the "\" mark, C/C++ expects the next character to a special character. In the above example, "\t" become a tab. For files, you have to have two slashes "\\", that may be the problem.

Wim,
You may be correct about the AnsiString, I'm not familar with that particular component. James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
2ffat -

I understand escape characters, it just didn't work in this case. I needed to cast them to wchar_t*

Thanks

Mindy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top