How would you open a file for reading in Go?

  • os.OpenFile()
  • os.Open()
  • file.Open()
  • os.Read()
In Go, you would typically use the os.Open() function to open a file for reading. It returns a *os.File pointer that can be used for reading data from the file. os.OpenFile() can also be used for more advanced file opening scenarios where you can specify additional flags and permissions.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *