I am trying to copy a blob of data (some bytes) into a larger block at some position. I can do this easily enough in C, but now I am doing it in Python and I am curious as to what is the best/correct way to do this.
The way I did it was:
struct.pack_into("p", buffer, pos, str(data))
Where data and buffer are of type bytearray. Python would not let me copy the data into the buffer without converting it to a string (see the type conversion above), so I was wondering what is the correct way to insert one bytearray into another?