Append to a file in Go

后端 未结 6 721
一个人的身影
一个人的身影 2020-12-04 08:12

So I can read from a local file like so:

data, error := ioutil.ReadFile(name)

And I can write to a local file

ioutil.WriteF         


        
6条回答
  •  一生所求
    2020-12-04 08:57

    If you also want to create the file

    f, err := os.OpenFile(filename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)

提交回复
热议问题