Standard library / mime/quotedprintable
quotedprintable.Reader.Read()
Read decoded bytes into a destination buffer; handle short reads and EOF. Expected stdout: '5 café\n'.
Formal Syntax & Structure
go syntaxgo
func (r *Reader) Read(p []byte) (n int, err error)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| p | []byte | Byte buffer for reading or source bytes for writing, according to the operation. |
Return Value
(n int, err error)
Number of bytes read and error, including EOF.
Working Example
Example Snippetgo
package main
import ( "fmt" "io" "mime/quotedprintable" "strings")
func main() { r := quotedprintable.NewReader(strings.NewReader("caf=C3=A9")) b := make([]byte, 5) fmt.Println(must(io.ReadFull(r, b)), string(b))}
func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}