Incore Formatting

The iostream family supports I/O between the program and a terminal. The fstream family uses the same interface to provide I/O between a program and a file. The C++ library also provides an sstream family that uses the same interface to provide I/O between a program and a string object. That is, you can use the same ostream methods you've used with cout to write formatted information into a string object, and you can use istream methods such as getline() to read information from a string object. The process of reading formatted information from a string object or of writing formatted information to a string object is termed incore formatting. Let's take a brief look at these facilities. (The sstream family of string support ...

Get The Waite Group's C++ Primer Plus, Third Edition 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.