Chapter 1
Filing Information with the Streams Library
IN THIS CHAPTER
Seeing the need for a streams library
Opening a file
Dealing with errors
Working with flags to customize your file opening
You’ve heard of rivers, lakes, and streams, and it’s interesting just how many common words are used in computer programming. That’s handy, because it lets programmers use words they already know with similar meaning. Using common terms makes it easier to visualize abstract concepts in a concrete way.
Most programmers think of a stream as a file — the type stored on a hard drive, Universal Serial Bus (USB) flash drive, or Secure Digital (SD) card. But streams go beyond just files. A stream is any type of data structure that you can access as a flow of data, essentially a sequence of bytes. Streams are used to access all sorts of devices, such as smart speakers. Rather than just fill a 500MB data structure and then drop it onto the hard drive, you write your data piece after piece; the information goes into the file.
Streams go further than a wide variety of devices, however. Opening an Internet ...
Get C++ All-in-One For Dummies, 4th 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.