File Input and Output

In the previous chapter, we talked about manipulating files and directories as entities without looking at their contents. However, in this chapter, we will take a different approach and look into the contents of files: you might consider this chapter one of the most important chapters in this book because file input and file output are primary tasks of any operating system.

The main purpose of this chapter is to teach how the Go standard library permits us to open files, read their contents, process them if we like, create new files, and put the desired data into them. There are two main ways to read and write files: using the io package and using the functions of the bufio package. However, both packages work in a ...

Get Go Systems Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.