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 comparative way.
This chapter will tell you about the following:
- Opening files for writing and reading
- Using the io package for file input and...