TSfwrite(3) attempts to write length bytes of data from the buffer buf to the file