tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/semihosting/stdio.go (about)

     1  package semihosting
     2  
     3  // These three file descriptors are connected to the host stdin/stdout/stderr,
     4  // and can be used for logging.
     5  var (
     6  	Stdin  = File{fd: 0}
     7  	Stdout = File{fd: 1}
     8  	Stderr = File{fd: 2}
     9  )
    10  
    11  // File represents a semihosting file descriptor.
    12  type File struct {
    13  	fd uintptr
    14  }
    15  
    16  // Write writes the given data buffer to the file descriptor, returning an error
    17  // if the write could not complete successfully.
    18  func (f *File) Write(buf []byte) error {
    19  	return Write(f.fd, buf)
    20  }