Example #1
0
//The raw read and write functions return the number of bytes read or written (which should be the same as the bytes parameter) and any error that occurs while reading or writing
// needs test
func (f *File) WriteRaw(data []byte) (written int64, err error) {
	written = int64(C.sf_write_raw(f.s, unsafe.Pointer(&data[0]), C.sf_count_t(len(data))))
	if written != int64(len(data)) {
		err = sErrorType(C.sf_error(f.s))
	}
	return
}
Example #2
0
//The raw read and write functions return the number of bytes read or written (which should be the same as the bytes parameter) and any error that occurs while reading or writing
// needs test
func (f *File) ReadRaw(data []byte) (read int64, err error) {
	read = int64(C.sf_read_raw(f.s, unsafe.Pointer(&data[0]), C.sf_count_t(len(data))))
	if read != int64(len(data)) {
		err = sErrorType(C.sf_error(f.s))
	}
	return
}