mirror of https://github.com/tinygo-org/tinygo.git
wasmstm32webassemblymicrocontrollerarmavrspiwasiadafruitarduinocircuitplayground-expressgpioi2cllvmmicrobitnrf51nrf52nrf52840samd21tinygo
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
700 B
24 lines
700 B
// +build darwin linux,!baremetal freebsd,!baremetal
|
|
|
|
package os
|
|
|
|
import (
|
|
"syscall"
|
|
)
|
|
|
|
// Read reads up to len(b) bytes from the File. It returns the number of bytes
|
|
// read and any error encountered. At end of file, Read returns 0, io.EOF.
|
|
func (f *File) Read(b []byte) (n int, err error) {
|
|
return syscall.Read(int(f.fd), b)
|
|
}
|
|
|
|
// Write writes len(b) bytes to the File. It returns the number of bytes written
|
|
// and an error, if any. Write returns a non-nil error when n != len(b).
|
|
func (f *File) Write(b []byte) (n int, err error) {
|
|
return syscall.Write(int(f.fd), b)
|
|
}
|
|
|
|
// Close closes the File, rendering it unusable for I/O.
|
|
func (f *File) Close() error {
|
|
return syscall.Close(int(f.fd))
|
|
}
|
|
|