String Convert
-
Hi How can i convert const std::string& sMyString to a CString ? Can anyone help thanks Simon
what about reading the docs first ? did you see the method
std::string::c_str()
?std::string s = "hello";
CString str = s.c_str();[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
what about reading the docs first ? did you see the method
std::string::c_str()
?std::string s = "hello";
CString str = s.c_str();[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
Provided
UNICODE
is not defined... ;PIf the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Provided
UNICODE
is not defined... ;PIf the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]that's right. otherwise, the following should do it :
CString str = CA2T(s.c_str());
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
Hi How can i convert const std::string& sMyString to a CString ? Can anyone help thanks Simon
-
that's right. otherwise, the following should do it :
CString str = CA2T(s.c_str());
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
Or simply use std::tstring[^], then it does not matter if UNICODE is defined or not.
:omg: I didn't know the std:: namespace had implemented such a container... or is it MS that voluntarily pushed themselves into the std namespace (which is normally reserved to the C++ standard only) with such ? (BTW, i don't have a compiler now, and lazy to search for more myself, so, just curious, how is it defined ? i'd bet for
namespace std { typedef basic_string<TCHAR> tstring; }
... what it is actually ?)[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
:omg: I didn't know the std:: namespace had implemented such a container... or is it MS that voluntarily pushed themselves into the std namespace (which is normally reserved to the C++ standard only) with such ? (BTW, i don't have a compiler now, and lazy to search for more myself, so, just curious, how is it defined ? i'd bet for
namespace std { typedef basic_string<TCHAR> tstring; }
... what it is actually ?)[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
don't mind for the mail, I just understood. so YOU are pushing code into std, ha ?! lol well, the coding looks clean enough. it's ok for this time. you can pass your way :rolleyes:
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]