Write up to count bytes into buffer at offset to the PTY. The number of bytes written will be returned.