Last active
January 16, 2017 05:19
-
-
Save pagoenka/6a13e022785b552f1caa to your computer and use it in GitHub Desktop.
Writing to file in Go lang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"os" | |
) | |
func main() { | |
fileHandle, _ := os.Create("output.txt") | |
writer := bufio.NewWriter(fileHandle) | |
defer fileHandle.Close() | |
fmt.Fprintln(writer, "String I want to write") | |
writer.Flush() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment