idnum,basepos:integer;
inbuf:array of byte;
basepos:=16;
idnum:=PInteger(@inbuf[basepos])^;这一行是什么意思,谁能解释一下,谢谢

解决方案 »

  1.   

    idnum:=PInteger(@inbuf[basepos])^;分解如下:
    @inbuf[basepos]             获得inbuf[basepos]这个值在内存中地址
    PInteger(@inbuf[basepos])   将上面的地址值通过强制类型转换变为指向Integer的一个指针
    PInteger(@inbuf[basepos])^  获取这个指针所指向地址的内容,是一个Integer值, 即将inbuf[basepos]、inbuf[basepos+1]、inbuf[basepos+2]、inbuf[basepos+3]这四个连续字节的内容按Integer类型取出。
      

  2.   

    这样搞真有意思,用意也就一句话
    从inbuf的basepos位置开始取integer大小的字节作为整数赋给idnum
      

  3.   

    用c更简洁
    int idnum,basepos;
    unsigned char *inbuf;
    basepos=16;
    idnum=*(int *)(inbuf+basepos);