CString and string
-
how do I convert from CString to string, and vice versa. Also, what does it mean when they say convert to system string? --Star
It depends on the exact type of the target string, for instance you can do
CString myCString = "Hi";
const char * myCLikeString = myCString;to obtain a (constant) C-like string, since
CString
defines theLPCSTR
cast operator. andconst char * myCLikeString = "Hello";
CString myCString = myCLikeString;thanks to
CString::=
operator. :)If 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.
-
how do I convert from CString to string, and vice versa. Also, what does it mean when they say convert to system string? --Star
See The Complete Guide to C++ Strings, Part II - String Wrapper Classes[^]
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Dunder-Mifflin, this is Pam.