I have to read and write binary data, where each element of data:
- size = 2 bytes (16 bit)
- encoding = signed 2's complement
- endiannes = big or little (must be selectable)
Is it possible without using any external module? If yes,
- How to read such data from a binary file using read() into an array L of integers?
- How to write array of integers L into a binary file using write()?