可以把它转换成CSTRING类型的: MSDN中的例子: //The following example demonstrates the use of CString::Insert. CString str("HockeyBest"); int n = str.Insert(6, "is "); ASSERT(n == str.GetLength()); printf("1: %s\n", (LPCTSTR) str); n = str.Insert(6, ' '); ASSERT(n == str.GetLength()); printf("2: %s\n", (LPCTSTR) str); n = str.Insert(555, '!'); ASSERT(n == str.GetLength()); printf("3: %s\n", (LPCTSTR) str);//this code generates these lines of output:1: Hockeyis Best 2: Hockey is Best 3: Hockey is Best!
MSDN中的例子:
//The following example demonstrates the use of CString::Insert.
CString str("HockeyBest");
int n = str.Insert(6, "is ");
ASSERT(n == str.GetLength());
printf("1: %s\n", (LPCTSTR) str); n = str.Insert(6, ' ');
ASSERT(n == str.GetLength());
printf("2: %s\n", (LPCTSTR) str); n = str.Insert(555, '!');
ASSERT(n == str.GetLength());
printf("3: %s\n", (LPCTSTR) str);//this code generates these lines of output:1: Hockeyis Best
2: Hockey is Best
3: Hockey is Best!
_tcsncpy( str + 4, _T( "123" ), 3 );