Standard library / bufio
bufio.Reader.ReadByte()
Reads a single byte or returns an error; unlike ReadRune it does not decode UTF-8. Expected stdout: 'a <nil>\n'.
Formal Syntax & Structure
go syntaxgo
func (b *Reader) ReadByte() (byte, error)Return Value
(byte, error)
Reads a single byte or returns an error; unlike ReadRune it does not decode UTF-8.
Working Example
Example Snippetgo
package main
import ( "bufio" "fmt" "strings")
func main() { r := bufio.NewReader(strings.NewReader("abc")) c, e := r.ReadByte() fmt.Println(string(c), e)}