Change read and write bytes to take a void pointer