The byte at offset in the memory at p, as a number from 0 to 255.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(c_ptr), | intent(in) | :: | p |
start of the memory |
||
| integer, | intent(in) | :: | offset |
in bytes, 0 for the first byte |
integer function byte_at(p, offset) result(b) !! The byte at `offset` in the memory at `p`, as a number from 0 to 255. type(c_ptr), intent(in) :: p !! start of the memory integer, intent(in) :: offset !! in bytes, 0 for the first byte integer(c_int8_t), pointer :: raw(:) call c_f_pointer(p, raw, [offset + 1]) b = iand(int(raw(offset + 1)), 255) end function byte_at