Golang os.File.Fd() function example

package os

Golang os.File.Fd() function usage example

  file, err := os.Open("file.data")
  if err != nil {
 fmt.Println(err)
 continue
  }
  fileDescriptor := int(file.Fd()) // get the unix descriptor
  file.Close()

References :

http://golang.org/pkg/os/#File.Fd

http://www.theunixschool.com/2010/08/unix-file-descriptors.html

Advertisement