Esempio n. 1
0
func (rw *RWops) Write(data []byte) (int, error) {
	n := C.write(rw.c, unsafe.Pointer(&data[0]), 1, C.size_t(len(data)))
	switch {
	case n == 0:
		return 0, io.EOF
	case n < 0:
		return 0, getError()
	}

	return int(n), nil
}
Esempio n. 2
0
// WritePacketData transmits a raw packet.
func (h *TPacket) WritePacketData(pkt []byte) error {
	_, err := C.write(h.fd, unsafe.Pointer(&pkt[0]), C.size_t(len(pkt)))
	return err
}
Esempio n. 3
0
func (self *Mem) Write(body string) C.int {
	if len(body) >= self.size {
		return C.int(0)
	}
	return C.write(C.CString(body))
}
Esempio n. 4
0
func WriteGlx() {
	//
	C.write(display, window)
}