Golang bufio.NewWriter function example
package bufio
NewWriter returns a new Writer whose buffer has the default size.
Golang bufio.NewWriter function usage example
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
screenWriter := bufio.NewWriter(os.Stdout)
fmt.Fprint(screenWriter, "Hello, ")
fmt.Fprint(screenWriter, "world! 你好世界!\n")
screenWriter.Flush() // Don't forget to flush!
}
Output :
Hello, world! 你好世界!
Reference :
Advertisement
Something interesting
Tutorials
+5.9k Unix/Linux : How to test user agents blocked successfully ?
+10.3k Golang : Wait and sync.WaitGroup example
+7.9k Swift : Convert (cast) String to Double
+20.9k Golang : Read directory content with os.Open
+18.8k Golang : Iterating Elements Over A List
+14.3k Golang : Chunk split or divide a string into smaller chunk example
+19.4k Golang : Calculate entire request body length during run time
+14.1k Golang: Pad right or print ending(suffix) zero or spaces in fmt.Printf example
+12.9k Android Studio : Highlight ImageButton when pressed on example
+20.5k Golang : Determine if directory is empty with os.File.Readdir() function
+9.5k Golang : Terminate-stay-resident or daemonize your program?
+8.5k Golang : Convert word to its plural form example