8. I/O Streams

What you see is all you get.

– Brian W. Kernighan

Introduction

Output

Input

I/O State

I/O of User-Defined Types

Formatting

File Streams

String Streams

Advice

8.1. Introduction

The I/O stream library provides formatted and unformatted buffered I/O of text and numeric values.

An ostream converts typed objects to a stream of characters (bytes):

Image

An istream converts a stream of characters (bytes) to typed objects:

Image

The operations on istreams and ostreams are described in §8.3 and §8.2. The operations are type-safe, ...

Get A Tour of C++ 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.