1. Conversion of strings and numbers:
Atof (string-> double, Int, long), ITOA (INT-> string), ltoa (long int-> string)
Double-> cstring method: cstring: Format ("% d", & dx );
2. cstring to char *
// After forced type conversion, the cstring type can be converted to char *, for example:
Cstring CSTR = "Hello, world! ";
Char * zstr = (char *) (lpctstr) CSTR;
Of course, this is only the quickest way. Because cstring comes with a function that can convert the cstring object to const char *, that is, the lpctstr.
3. char * To cstring
// The char * type can be directly sent to the cstring for automatic conversion. For example:
Char * zstr = "Hello, world! ";
Cstring CSTR = zstr;
4. cstring to lpcstr
// Convert a cstring to an lpcstr string and obtain the cstring length.
Cstring CSTR = _ T ("Hello, world! ");
Int nlen = CSTR. getlength ();
Lpcstr lpszbuf = CSTR. getbuffer (nlen );
5. cstring to lpstr
// This is the same as the 4th tips, for example:
Cstring CSTR = _ T ("Hello, world! ");
Int nlen = Str. getlength ();
Lpstr lpszbuf = Str. getbuffer (nlen );