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
+18.2k Golang : Get command line arguments
+8.8k Yum Error: no such table: packages
+20.5k Golang : Pipe output from one os.Exec(shell command) to another command
+14.1k Golang : Check if a file exist or not
+4.8k Which content-type(MIME type) to use for JSON data
+27.7k PHP : Count number of JSON items/objects
+35.9k Golang : Integer is between a range
+36.4k Golang : Convert date or time stamp from string to time.Time type
+10.6k Golang : Flip coin example
+6.3k Golang : How to search a list of records or data structures
+9.8k Golang : Qt get screen resolution and display on center example
+18.7k Golang : Implement getters and setters