pc:PWidechar;allocmem(10000);caption:=inttostr(sizeof(pc)); =4
caption:=inttostr(length(pc)); =0
 我要求出是10000怎么办:

解决方案 »

  1.   

    pc:PWidechar;//--这儿定义的是一个指针类型.const  bufsize=10000;allocmem(10000);
    //这里是分配一块内存给这个指针,也就是说形成了一个指针数组.
    //对于指针数组来说,它有大小只能是你自己控制.caption:=inttostr(sizeof(pc)); =4
    caption:=inttostr(length(pc)); =0
     我要求出是10000怎么办://---这个大小你可以通过一个常量来定义.......
      

  2.   

    还是没解决我的问题.
    这么说:我给你一个PWidechar类型的指针,里面有值,不告诉你大小,你能取出里面的全部数据吗
      

  3.   

    呵~~,
    这么说:我给你一个PWidechar类型的指针,里面有值,不告诉你大小,你能取出里面的全部数据吗
    1.如果是字符串,你可以查找#0(NULL)结束符....var
      //p:pwidechar;
      p:pchar;
      str:string;
      counter:integer;
    begin
      getmem(p,101);
      fillchar(p^,100,#48);  str:='';
      counter:=0;
      try
       while  not (p^=#0) do
        begin
          str:=str+inttohex(ord(p^),2);
          inc(p);
          inc(counter);
        end;
       //---p:pchar;显示100;
       //---p:pWidechar;显示50;
       showmessage('get char total:'+inttostr(counter));
       showmessage(str);
       dec(p,counter);
      finally
         freemem(p);
      end;
    end;