Fixed missing include file and const pointers.
Use the write interface instead of the read interface . . . .