22

I find os.Open() return a O_RDONLY file and os.Create() return a O_RDWR but can't find a method return a APPEND file pointer.

Any help ?

WoooHaaaa
  • 19,732
  • 32
  • 90
  • 138

1 Answers1

55

The OpenFile takes a flags argument that you can use:

 os.OpenFile("foo.txt", os.O_RDWR|os.O_APPEND, 0660);

Used with O_CREATE , OpenFile can also serve the same purpose as os.Create()

Bartosz
  • 6,055
  • 3
  • 27
  • 17
nos
  • 223,662
  • 58
  • 417
  • 506