Skip to main content

Input/Output

  • Chapter
  • First Online:
  • 2259 Accesses

Abstract

In C++, input and output (I/O for short) mostly happens through an abstraction known as streams. Streams allow you to perform I/O operations without knowing the details of their target or source. Be it your command-line interface, a string, or a file—streams offer an easy, uniform interface to communicate with any of these.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   34.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   44.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 1.

    The u8path() factory function will be deprecated by C++20 with the introduction of the char8_t character type. With this addition, the normal path constructors will be updated to support UTF-8 encoded strings with type char8_t.

  2. 2.

    Will normally become char8_t in C++20.

  3. 3.

    Some library implementations use errno (see Chapter 8) to report errors for C-style I/O functions, including the printf() and scanf() functions: consult your library documentation to confirm.

  4. 4.

    wint_t is defined in <cwchar> and is an alias for an integral type large enough to hold any wide character (wchar_t value) and at least one value that is not a valid wide character (WEOF).

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Peter Van Weert and Marc Gregoire

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Van Weert, P., Gregoire, M. (2019). Input/Output. In: C++17 Standard Library Quick Reference. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-4923-9_5

Download citation

Publish with us

Policies and ethics