Join for free

...

/

Reading and Writing Files with Slices

Reading and Writing Files with Slices

This lesson explains in detail how to use a slice for reading and writing to files.

We'll cover the following...

Slices provide the standard-Go way to handle I/O buffers; they are used in the following second version of the function cat, which reads a file in an infinite for-loop (until end-of-file EOF) in a sliced buffer, and writes it to standard output.