Introduction
In the previous chapter, we covered one of the most challenging topics – concurrency in C++. We looked at the main multithreaded concepts and differentiated between synchronous, asynchronous, and threaded execution in C++. We learned the key points about synchronization, data hazards, and race conditions. Finally, we looked at working with threads in modern C++. In this chapter, we will go deeper and learn how to handle I/O in multithreaded applications.
This chapter is dedicated to streams and I/O in C++. I/O is the general concept of input and output operations. The main purpose of this part of the Standard Library is to provide a clear interface regarding the input and output of data. But this is not the only goal. There are a lot of situations where I/O can help us in our applications. It's hard to imagine any application that doesn't write errors or exceptional situations into the log file with the purpose of sending it to the development team for analysis...