Standard library / bufio

bufio.Writer.Flush()

Writes buffered data to the underlying writer and reports errors. Flush is not a disk durability guarantee. Expected stdout: 'abc <nil>\n'.

Formal Syntax & Structure

go syntaxgo
func (b *Writer) Flush() error

Return Value

error

Writes buffered data to the underlying writer and reports errors.

Working Example

Example Snippetgo
package main
import (  "bufio"  "bytes"  "fmt")
func main() {  var b bytes.Buffer  w := bufio.NewWriter(&b)  w.WriteString("abc")  e := w.Flush()  fmt.Println(b.String(), e)}
Go Reference