Conversion between string, CString, char *
Int to CString:CString. Format ("% d", int );...............................String to CStringCString. format ("% s", string. c_str ());C_str () is indeed better than data.....................................
turn: char*, char[], CString, string conversion (i) OverviewString and CString are string template classes, string classes defined by the Standard template class (STL), are included in the C + + standard;CString (typedef CStringT > CString) is the
Constraints for assigning values according to ansi c:
1. Both operands are pointers to compatible types with or without delimiters.
2. the type pointed to by the Left pointer must have all the qualifiers of the type pointed to by the right
Cstring, Int, String, char * ConversionString to cstringCstring. Format ("% s", String. c_str ());Convert Char to cstringCstring. Format ("% s", char *);Char to stringString S (char *);String to char *Char * P = string. c_str ();Cstring to
Convert cstring to char *
Cstring CSTR;
Char * P = (lpstr) (lpctstr) CSTR;
String to cstringCstring. Format ("% s", String. c_str ());
Convert Char to cstringCstring. Format ("% s", char *);
Char to stringString S (char *);
String to
(1) Overview
String and cstring are both string template classes. string is a string class defined by the standard template class (STL) and has been incorporated into the C ++ standard;
Cstring (typedef cstringt> cstring) is the most common
Comparison of cstring, string and char *
(1) Overview
String and cstring are both string template classes. string is a string class defined by the standard template class (STL) and has been incorporated into the C ++ standard;
Cstring (typedef
String and cstring are both string template classes. string is a string class defined by the standard template class (STL) and has been incorporated into the C ++ standard;
Cstring (typedefCstringt> cstring) is visualC ++ is the most common string
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.