Standard library / bytes
bytes.Buffer.ReadByte()
Consumes one byte and returns it, or io.EOF when empty. Expected stdout: '65 <nil>\n'.
Formal Syntax & Structure
go syntaxgo
func (b *Buffer) ReadByte() (byte, error)Return Value
(byte, error)
Consumes one byte and returns it, or io.EOF when empty.
Working Example
Example Snippetgo
package main
import ( "bytes" "fmt")
func main() { b := bytes.NewBufferString("A") v, e := b.ReadByte() fmt.Println(v, e)}