From: Derek on
I was trying exact your sample but with LPCTSCT since I have unicode and
I'm getting that error (VC7):
error C2440: 'initializing' : cannot convert from
'ATL::CSimpleStringT<BaseType>::PCXSTR' to
'std::basic_string<_Elem,_Traits,_Ax>'

with

[

BaseType=TCHAR

]

and

[

_Elem=char,

_Traits=std::char_traits<char>,

_Ax=std::allocator<char>

]

No constructor could take the source type, or constructor overload
resolution was ambiguous

thanks

"Tim Ward" <tw2(a)ipaccess.com> wrote in message
news:45h2bgF6p7ofU1(a)individual.net...
> "Ajay Kalra" <ajaykalra(a)yahoo.com> wrote in message
> news:1140017418.811732.197740(a)g14g2000cwa.googlegroups.com...
>>
>> What exactly is the problem? All you are using is the operator LPCTSTR
>> of CString. Show the code that is not working.
>
> Yes, I'd expect that to work better than the
>
>> string Str = (LPCSTR)Temp;
>
> in the original answer.
>
> --
> Tim Ward
> Brett Ward Limited - www.brettward.co.uk
>
>


From: Ajay Kalra on
Are you using string or tstring. Since your compiler settings are
UNICODE, you will need to have a wide string to do this conversion.
There are other macros such as T2A which will convert it to an ascii
string.

---------
Ajay Kalra
ajaykalra(a)yahoo.com

From: Derek on
No,
I was trying exact your sample but with LPCTSTR since I have unicode and
I'm getting that error (VC7):
error C2440: 'initializing' : cannot convert from
'ATL::CSimpleStringT<BaseType>::PCXSTR' to
'std::basic_string<_Elem,_Traits,_Ax>'
with
[
BaseType=TCHAR
]
and
[
_Elem=char,
_Traits=std::char_traits<char>,
_Ax=std::allocator<char>
]

No constructor could take the source type, or constructor overload
resolution was ambiguous

(With LPCSTR error cannot convert CString to LPCSTR)

thanks

"AliR" <AliR(a)online.nospam> wrote in message
news:%XJIf.33200$H71.19133(a)newssvr13.news.prodigy.com...
>I am a bit lost. Did this finally work or not? And what was the solution?
>
> I personally have used the LPCSTR operator with great success. What to
> know
> if I have been doing the wrong thing all this time.
>
> string str = (LPCSTR)Temp;
>
> AliR.
>
> "Derek" <der(a)yahoo.com> wrote in message
> news:egz$UubMGHA.3728(a)tk2msftngp13.phx.gbl...
>> Hi,
>> How to convert from CString to stl string?
>> I tried many things and doesn't work.
>> thanks
>>
>>
>
>


From: Derek on
There is no problem with conversion of wide CString with LPCTSTR,
that part works...

"Ajay Kalra" <ajaykalra(a)yahoo.com> wrote in message
news:1140026631.558581.95040(a)f14g2000cwb.googlegroups.com...
> Are you using string or tstring. Since your compiler settings are
> UNICODE, you will need to have a wide string to do this conversion.
> There are other macros such as T2A which will convert it to an ascii
> string.
>
> ---------
> Ajay Kalra
> ajaykalra(a)yahoo.com
>


From: Ajay Kalra on
Can you show the code which is causing this error?

---------
Ajay Kalra
ajaykalra(a)yahoo.com