How do I use python's ctypes library to read/write from a bytearray?
I can create a structure like below:
from ctypes import *
class Foo(Structure):
_fields_ = [
('b0', c_byte),
('b1', c_byte),
('s0', c_short),
('l0', c_long),
]
f = Foo(1, 0x42, 0xF00F, 0x12345678)
But dir(Foo) does not show any way to create a Foo from a bytearray and dir(f) doesn't show any way to convert a Foo into a bytearray or write to a bytearray. Am I missing something?