The input for your software will come from various sources: command-line options, the standard input, the network, and, frequently, files. Reading from an input itself is rarely the problem when dealing with external sources of data; some input might require a bit more setup, some are more straightforward, but generally it's just a matter of opening it and then reading from it.
The problem arises with what to do with the data that we read. There are thousands of formats out there, each with its own complexities, some are text-based and some are binaries. In this chapter, we will set recipes to deal with the most common formats that you will probably have to face during your life as a developer.