Reading from a File
This lesson provides coding examples and their explanations for reading from a file.
Reading data from a file #
Files in Go are represented by pointers to objects of type os.File
, also called file handles. The standard input os.Stdin
and output os.Stdout
we used in the previous lesson are both of type *os.File
. This is used in the following program:
Get hands-on with 1400+ tech skills courses.