How do you convert a System::String to const TCHAR*?

Recommended Answers

All 2 Replies

TCHAR is a macro -- you can't convert System::String to a macro, it doesn't make any sense. You can convert it to char* or wchar_t*, depending on whether you are compiling for UNICODE or not, but can't convert it to a macro.

See ToCharArray() here

Okay, so would it work if I tried to convert System::String to const wchar_t*? If yes, how?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.