Re: converting 'const wchar_t *' to 'const char * ?
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Thu, 06 Dec 2007 08:46:07 -0500
All const char * declarations should be replaced by LPCTSTR. All char * declarations
should be replaced by LPTSTR. Unless there is a compelling reason, std::string and
variations on that theme should not be used; CString is a good bit friendlier to MFC
programs.
joe
On Wed, 5 Dec 2007 20:38:48 -0800 (PST), jklioe <ranu2006@xxxxxxxxx> wrote:
Thanks for ur reply well I was converting a library source code fromJoseph M. Newcomer [MVP]
ANSCI to UNICODE
in a Function , const char * is used as follow (well I have cut short
the constructor code
InjectMachine(const char * Name,const char * Type)
and this method is called as follow
std::basic_string<TCHAR> Name_;
std::basic_string<TCHAR> Type_;
InjectMachine(Name_.c_str(),Type_.c_str()) // I get an error here when
i complile with UNICODE
On Dec 6, 8:54 am, Joseph M. Newcomer <newco...@xxxxxxxxxxxx> wrote:
First, show some code. The problem is that you are trying to convert a Unicode string to
an 8-bit character string, and we would need to see some context about why you are doing
this. The most common problems are simply coding errors, where you have erroneously
written a program under the delusion that char * is the way to represent a string pointer,
but there are many other issues, and in the absence of a concrete example it is hard to
say what should be done.
joe
On Wed, 5 Dec 2007 19:42:52 -0800 (PST), jklioe <ranu2...@xxxxxxxxx> wrote:
How to convert 'const wchar_t *' to 'const char *' ?
Joseph M. Newcomer [MVP]
email: newco...@xxxxxxxxxxxx
Web:http://www.flounder.com
MVP Tips:http://www.flounder.com/mvp_tips.htm
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- Re: converting 'const wchar_t *' to 'const char * ?
- From: jklioe
- Re: converting 'const wchar_t *' to 'const char * ?
- References:
- converting 'const wchar_t *' to 'const char * ?
- From: jklioe
- Re: converting 'const wchar_t *' to 'const char * ?
- From: Joseph M . Newcomer
- Re: converting 'const wchar_t *' to 'const char * ?
- From: jklioe
- converting 'const wchar_t *' to 'const char * ?
- Prev by Date: Re: Diffrence between EndDialog and OnClose
- Next by Date: Re: error rc2168 : resource too large
- Previous by thread: Re: converting 'const wchar_t *' to 'const char * ?
- Next by thread: Re: converting 'const wchar_t *' to 'const char * ?
- Index(es):
Relevant Pages
|