mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 05:33:04 +08:00
Update 12.11.md
纠错:为0时,写入文件失败。
This commit is contained in:
@@ -117,7 +117,7 @@ func main() {
|
|||||||
vc := VCard{"Jan", "Kersschot", []*Address{pa,wa}, "none"}
|
vc := VCard{"Jan", "Kersschot", []*Address{pa,wa}, "none"}
|
||||||
// fmt.Printf("%v: \n", vc) // {Jan Kersschot [0x126d2b80 0x126d2be0] none}:
|
// fmt.Printf("%v: \n", vc) // {Jan Kersschot [0x126d2b80 0x126d2be0] none}:
|
||||||
// using an encoder:
|
// using an encoder:
|
||||||
file, _ := os.OpenFile("vcard.gob", os.O_CREATE|os.O_WRONLY, 0)
|
file, _ := os.OpenFile("vcard.gob", os.O_CREATE|os.O_WRONLY, 0666)
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
enc := gob.NewEncoder(file)
|
enc := gob.NewEncoder(file)
|
||||||
err := enc.Encode(vc)
|
err := enc.Encode(vc)
|
||||||
|
Reference in New Issue
Block a user