在内存中的地址获取任意类型的值
语法
用法
Peek( [ datatype , ] address )
参数
address
在内存中获取值的地址。
datatype
说明
此过程返回对由内存地址给出的内存中的值的引用,等同于
*cast(ubyte ptr, address )
or
*cast(datatype ptr, address )
例子
Dim i As Integer, p As Integer Ptr
p = @i
Poke Integer, p, 420
Print Peek(Integer, p)
将产生输出:
420
与QB差别
- 皮克不支持QB中的datatype 参数,只能返回单个字节。
- 皮克返回FB中的引用,因此可以用于设置地址的存储内容,如运算符*(值).
- DEF SEG 不再需要,因为FreeBASIC中的地址空间为32位。
参考