hbutils.binary.bool¶
CBoolType¶
c_bool¶
-
hbutils.binary.bool.
c_bool
= <hbutils.binary.bool.CBoolType object>¶ - Overview:
Reading and writing bool value like C language.
- Examples::
>>> import io >>> from hbutils.binary import c_bool >>> >>> with io.BytesIO(b'\x01\x00\x01\x00') as file: ... print(c_bool.read(file)) ... print(c_bool.read(file)) ... print(c_bool.read(file)) ... print(c_bool.read(file)) True False True False >>> with io.BytesIO() as file: ... c_bool.write(file, True) ... c_bool.write(file, False) ... c_bool.write(file, True) ... c_bool.write(file, False) ... print(file.getvalue()) ... b'\x01\x00\x01\x00'