I have a silly question.
How do I convert a STL string to a MFC CString in an elegant way?
using namespace std;
CString bob;
string fred;
bob = fred; // Deos not work, duh!
:confused:
Printable View
I have a silly question.
How do I convert a STL string to a MFC CString in an elegant way?
using namespace std;
CString bob;
string fred;
bob = fred; // Deos not work, duh!
:confused:
I would imagine:
Z.Code:std::string x = "Hello";
CString y = x.c_str();
How come I can't get std::string get to work in
my MFC dialog based exe ?
If I use std::string in my class,
I get error :
'std' : is not a class or namespace name
'string' : undeclared identifier
using namespace does not help either .
What's up with me ?
Probably didnt include <string>.
Z.
Nope, not that, still does not work:eek: :eek:
Maybe you included <string> before "stdafx.h". The compiler ignores any code prior to this include if activated.