For Programmers: Free Programming Magazines  


Home > Archive > VC Language > November 2005 > Re: convert TCHARto string









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: convert TCHARto string
Scherbina Vladimir

2005-11-27, 7:04 pm

Just created a simple application with following code: (everything works)

#include <windows.h>
#include <tchar.h>
#include <string>

void main (void)
{
TCHAR tch[] = "assasa";
std::string str = tch;
}

--
Scherbina Vladimir

"Maileen" <noemail@nospam.com> wrote in message
news:uvRQ6c48FHA.2364@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> I'm starting to be crazy.... ;-(
> i'm not successful to convert a simple TCHAR[] to string
>
> Could someone help me please ?
>
> i tried to pass through a simple pointer...it does not work.
> i tried to pass through a simple copy to string, it does not work...
>
> thanks a lot,
>
> Maileen



Scherbina Vladimir

2005-11-27, 7:04 pm

In addition, if you have _UNICODE macro defined, use

std::wstring str = tch;

--
Scherbina Vladimir

"Scherbina Vladimir" <vladimir.scherbina@gmail.com> wrote in message
news:OvO%237w48FHA.1032@TK2MSFTNGP11.phx.gbl...
> Just created a simple application with following code: (everything works)
>
> #include <windows.h>
> #include <tchar.h>
> #include <string>
>
> void main (void)
> {
> TCHAR tch[] = "assasa";
> std::string str = tch;
> }
>
> --
> Scherbina Vladimir
>
> "Maileen" <noemail@nospam.com> wrote in message
> news:uvRQ6c48FHA.2364@TK2MSFTNGP12.phx.gbl...
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com