as title

解决方案 »

  1.   

    function StrPas(const Str: PChar): string;
      

  2.   

    是呀 string(p) 就可以
    如果是其他类型的 指针 可能还需要这样string(PChar(p)); //p 非PChar类型指针
      

  3.   

    pChar-->string,可以不转换.
      这个我们可以从strPas()的源看出.
    function StrPas(const Str: PChar): string;
    begin
      Result := Str;
    end;pByte-->string:pChar(pointer(B:pByte)).先将pByte转成pChar,再转成string;-->推广:
        指针类型的互转:要转的类型(pointer(原来的类型));
        pByte->pInteger:pInteger(pointer(pByte));
        pInteger->pChar:pChar(pointer(pInteger));
        ..类似