例如:
  char* 的内容是: testaabbccddaa,怎么变成  test123aabbccdd123aa。就是加入123

解决方案 »

  1.   

    可以把它转换成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!
      

  2.   

    但CString不是引用类型吧,就是改了CString,但不会改char*的数据内容吧。
      

  3.   

    自己去写一个copy函数就行了   很难么  比如char *stsInsert(char * & stedest,int nLoc)// 1/传入的字符串   2、添加的位置   具体函数细节自己去写吧
      

  4.   

    stedest 做传入参数又是传出参数
      

  5.   

    memmove( str + 7, str + 4, _tcslen( str + 4 ) * sizeof( TCHAR ) );
    _tcsncpy( str + 4, _T( "123" ), 3 );