converting COleVariant to CString

How to convert a COleVariant to CString?
buccsoAsked:
Who is Participating?
 
jkrCommented:

COleVariant var;
CString str;

// ...

str = (LPCTSTR) var.bstrVal;
0
 
buccsoAuthor Commented:
It only converts the first char of the string. To work correctly you have to skip the cast.


0
 
jkrCommented:
You should have rejected insted of grading a 'D'...
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
buccsoAuthor Commented:
With a simple modification it solved the problem. I couldn't reject it.
0
 
jkrCommented:
'D' is 'hardly acceptable' - this is a bit insulting (at least for me)
0
 
buccsoAuthor Commented:
I think you are a bit huffy. What does it matter, which greade do you get?
Nothing.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.