Introduction
This challenge aims to test your ability to write files in Go. You will learn how to write a string or bytes into a file and how to use buffered writers.
This challenge aims to test your ability to write files in Go. You will learn how to write a string or bytes into a file and how to use buffered writers.
You need to write a Go program that writes a string and bytes into a file and uses buffered writers.
## Try running the file-writing code.
$ go run writing-files.go
wrote 5 bytes
wrote 7 bytes
wrote 9 bytes
## Then check the contents of the written files.
$ cat /tmp/dat1
hello
go
$ cat /tmp/dat2
some
writes
buffered
## Next we'll look at applying some of the file I/O ideas
## we've just seen to the `stdin` and `stdout` streams.
In this challenge, you learned how to write a string or bytes into a file and how to use buffered writers in Go.