V
V
v- death2015-10-23 12:46:24
go
v- death, 2015-10-23 12:46:24

What should be passed as the first argument to os.NewFile?

https://golang.org/pkg/os/#NewFile
I can't figure out what the first argument is being passed here. did so

os.Mkdir("logs", 0777)
os.NewFile(0777, "logs/err.log")

The compiler does not see errors. The folder is created but the file is not in it. Thanks in advance for your help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem, 2015-10-23
@vGrabko99

fd - file descriptor. The NewFile function returns a File type with the specified file descriptor and name, but it does not create a new file on the system.
You can use os.OpenFile to create a new file .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question