Understanding the Vocabulary of I/O - C++

The core of this chapter is I/O (input/output). I/O refers to sending (outputting) and receiving (inputting) data from various hardware devices, such as hard drives, modems, and keyboards.

Hint :Although C++ does not directly support I/O operations as part of the base language, it does include I/O as part of the standard library. Even with I/O as part of the standard library, C++ leaves much of the application of streams up to programmers. By this, we mean that C++ has a very basic support for I/O, so programmers must adjust this low-level support to meet their needs.

Although C++ does not directly support I/O operations as part of the base language, it does include I/O as part of the standard library. Even with I/O as part of the standard library, C++ leaves much of the application of streams up to programmers. By this, we mean that C++ has a very basic support for I/O, so programmers must adjust this low-level support to meet their needs.

In order to learn I/O, you need to know the terminology. Here are several of the definitions we use throughout this chapter:

  • Stream object. Acts as both a source and a destination for bytes. The stream object manipulates an ordered linear sequence of bytes. This series of bytes can represent a screen, a file, or anywhere else the programmer wants bytes to go. You find the classes that handle streams in several of the library files: <fstream>, <iomanip>, <ios>, <iosfwd>, <iostream>, <istream>, <ostream>, <sstream>, <streambuf>, and <strstream>.
  • Manipulator. Manipulates the data of the stream in some way. For example, a manipulator can make all characters uppercase or can convert numbers using decimal notation to hexadecimal notation.
  • Insertion. Places bytes into the stream. The methods that perform the insertions are called inserters.
  • Extraction. Takes bytes from the stream. The methods that perform the extractions are called extractors.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

C++ Topics