Implement twrite().