package main import ( "bufio" "fmt" "io" "os" ) func main() { fil, err := os.OpenFile("C:/Documents and Settings/xxx/Desktop/tax.txt", os.O_RDWR|os.O_APPEND, 0420) if err != nil { fmt.Printf("Error: %s\n", err) return } defer fil.Close() fil.WriteString("Hello World!\n") }
原文:http://www.cnblogs.com/rojas/p/4395880.html