Hi
I need to convert an stl string to a TCHAR*. I found lots of information searching on the web, but I can't understand what is the best method. I want somenthig like this:
std::string myString = "hello";
TCHAR* myTcharString = [somefuntion](myString);
Someone knows the answer
thanks

converting std::string to TCHAR
Nimrand
or maybe I don't understand something clear (anche it is not too strange! ;-) )
ChrisKinsman
mtfck
You could do a compile time version of string like this:
#include
<string>namespace
std {#if
defined _UNICODE || defined UNICODE typedef wstring tstring;#else
typedef string tstring;
#endif
}
Then you could use tstring instead of string and it would depend on the compile options.
Tom
RayinSpain
If I'm understanding the question correctly I think you could just use:
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vcstdlib/html/vclrf_string_basicstringcstr.asp
or
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vcstdlib/html/vclrf_string_basicstringdata.asp
Tom
Manish 3177
No problem... hope it helps.
Tom