You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 7, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 7, 2024. It is now read-only.
Question: how would i use DataReader.read_bytes()? #41
Say have a DataReader set up from a buffer. And i want to read all bytes at once. so i feed the data reader an empty winsdk.system.array("B"). I know the buffer isnt empty. However it appears that read_bytes does not write to the array. Am I doing something wrong?
It is best to avoid DataReader and use Python APIs like the struct module instead. Buffer objects can be passed directly to anything in Python that uses the Python buffer protocol. So return bytearray(buffer) would probably do what you want in this case.
Activity
a-usr commentedon Nov 29, 2023
I am asking because IMO calling read_byte() for every byte i want to read takes way too long
dlech commentedon Nov 29, 2023
It is best to avoid
DataReaderand use Python APIs like thestructmodule instead.Bufferobjects can be passed directly to anything in Python that uses the Python buffer protocol. Soreturn bytearray(buffer)would probably do what you want in this case.