-
-
Save thedevsaddam/e84464b1f30117439b812399662a25f7 to your computer and use it in GitHub Desktop.
Append to file in Go lang
This file contains 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.OpenFile("output.txt", os.O_APPEND, 0666) | |
writer := bufio.NewWriter(fileHandle) | |
defer fileHandle.Close() | |
fmt.Fprintln(writer, "String I want to append") | |
writer.Flush() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment