OpenFile parameters

OpenFile function takes three parameters and I understand what first two are used for, but I struggle to understand what the third one is used for
example of using OpenFile function:

file, err = os.OpenFile("test.txt", os.O_APPEND, 0666)

The first parameter is the file name, the second parameter is what we can do with the file (in this case - append), but what does the third parameter determine?

Permissions (read/write/execute)
https://pkg.go.dev/io/ioutil#WriteFile

Thanks you, could you tell me where can I read about all the existing permission modes,please?

http://permissions-calculator.org is one link. I have never used the first position. 0777 is read/write/execute for all

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.