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
+6.3k Golang : Word limiter example
+31.3k Golang : Smarter Error Handling with strings.Contains()
+7.1k Golang : Number guessing game with user input verification example
+13.4k Golang : Save(pipe) HTTP response into a file
+8k Golang : Go as a script or running go with shebang/hashbang style
+17.2k Golang : Write file with io.WriteString
+16.2k Golang : How to remove certain lines from a file
+5.4k Grep : How to grep for strings inside binary data
+10k Use systeminfo to find out installed Windows Hotfix(s) or updates
+7.8k Golang : Simple histogram example
+4.6k Linux/Unix/PHP : Restart PHP-FPM