The below code is okay to find the header locations in a .bin file. But I don't want to read whole file at a time. Because the header has different byte format. If I read the whole as a uint16, I will not be able to get those bytes(some are uint8 and uint32). What is the solution so that I can read the file to find the header location and then I can assign the datatype for the header for the information. Basically discard all data before the header and read the header(2bytes-2bytes[little endian]-2bytes[big endian]-1bytes-1byte-......) Thanks in advance!!!!
with open(filename, mode='rb') as f: b = f.read() np_data = np.frombuffer(b, dtype=np.uint16) findIndex = np.where(np_data == int("00000050", 16))
Larz60+ write Mar-05-2021, 04:21 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.
Also fixed indentation
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.
Also fixed indentation