Standard library / bytes
bytes.Reader.ReadByte()
Reads one byte and advances the cursor; returns io.EOF when exhausted. Expected stdout: '97 <nil>\n'.
Formal Syntax & Structure
go syntaxgo
func (r *Reader) ReadByte() (byte, error)Return Value
(byte, error)
Reads one byte and advances the cursor; returns io.EOF when exhausted.
Working Example
Example Snippetgo
package main
import ( "bytes" "fmt")
func main() { r := bytes.NewReader([]byte("aé")) b, e := r.ReadByte() fmt.Println(b, e)}