github.com/aykevl/tinygo@v0.5.0/src/os/file_other.go (about) 1 // +build avr cortexm wasm 2 3 package os 4 5 import ( 6 _ "unsafe" 7 ) 8 9 // Read is unsupported on this system. 10 func (f *File) Read(b []byte) (n int, err error) { 11 return 0, ErrUnsupported 12 } 13 14 // Write writes len(b) bytes to the output. It returns the number of bytes 15 // written or an error if this file is not stdout or stderr. 16 func (f *File) Write(b []byte) (n int, err error) { 17 switch f.fd { 18 case Stdout.fd, Stderr.fd: 19 for _, c := range b { 20 putchar(c) 21 } 22 return len(b), nil 23 default: 24 return 0, ErrUnsupported 25 } 26 } 27 28 // Close is unsupported on this system. 29 func (f *File) Close() error { 30 return ErrUnsupported 31 } 32 33 //go:linkname putchar runtime.putchar 34 func putchar(c byte)