如题:
    fixed (char* str = ((char*)src))
            {
                char* chPtr = str;
                fixed (char* chRef = dest)
                {
                    byte* numPtr = (byte*)(chPtr + srcIndex);
                    byte* numPtr2 = (byte*)(chRef + destIndex);
                    memcpyimpl(numPtr, numPtr2, num);
                    str = null;
                }
            }

解决方案 »

  1.   

    string src;而(char*)src 强制转换出错。
      

  2.   

    你这是C#嘛?还有指针,还有memcpyimpl……
    C#中的安全代码没有char*这玩意儿~~
      

  3.   

    如果是C++中,String 转char *可以用data(),
    比如:
    string src;
    char * des =  src.data();
      

  4.   

    当然是unsafe啦,自己解决了,谢谢各位
      

  5.   

    C# 中尽量不要使用指针 ,除非特殊情况下  因为C#的内存机制 强制转换的话使用(数据类型)   如果是string型   可以使用 char.Prase(str);进行转换!