Chp~16 - C PROGRAMMING Chapter 16 Streams Overview of...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
C++ PROGRAMMING Chapter 16 Streams , Overview of Streams Encapsulation , Figure 16.1. , Buffering Figure 16.2. , Figure 16.3. , Figure 16.4. , Figure 16.5. Streams and Buffers , Standard I/O Objects , Redirection Input Using cin Listing 16.1. cin handles different data types . Strings , String Problems Listing 16.2. Trying to write more than one word to cin . Listing 16.3. Multiple input . operator>> Returns a Reference to an istream Object Other Member Functions of cin Single Character Input Listing 16.4. Using get() with no parameters. Listing 16.5 Using get() with parameters. Getting Strings from Standard Input Listing 16.6. Using get() with a character array Listing 16.7. Using getline(). Using cin.ignore() Listing 16.8. Using ignore(). peek() and putback() Listing 16.9. Using peek() and putback(). Output with cout Flushing the Output Related Functions Listing 16.10. Using put(). , Listing 16.11. Using write(). Manipulators, Flags, and Formatting Instructions Using cout.width() Listing 16.12. Adjusting the width of output. , Setting the Fill Characters Listing 16.13. Using fill() . , Set Flags Listing 16.14. Using setf. , Streams Versus the printf() Function Listing 16.15. Printing with printf(). File Input and Output , ofstream , Condition States Opening Files for Input and Output Listing 16.16. Opening files for read and write . Changing the Default Behavior of ofstream on Open Listing 16.17. Appending to the end of a file Binary Versus Text Files , Listing 16.18. Writing a class to a file . Command-Line Processing Listing 16.19. Using command-line arguments . Listing 16.20. Using command-line arguments. Summary , , Quiz , Exercises
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Chapter 16 Streams Until now, you've been using cout to write to the screen and cin to read from the keyboard, without a full understanding of how they work. ToChapter, you will learn What streams are and how they are used. How to manage input and output using streams. How to write to and read from files using streams. Overview of Streams C++ does not, as part of the language, define how data is written to the screen or to a file, nor how data is read into a program. These are clearly essential parts of working with C++, however, and the standard C++ library now includes the iostream library, which facilitates input and output (I/O). The advantage of having the input and output kept apart from the language and handled in libraries is that it is easier to make the language "platform-independent." That is, you can write C++ programs on a PC and then recompile them and run them on a Sun Workstation. The compiler manufacturer just supplies the right library, and everything works. At least that's the theory. NOTE:
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/13/2012 for the course CS 131 taught by Professor Clayton during the Spring '08 term at Bethune Cookman.

Page1 / 35

Chp~16 - C PROGRAMMING Chapter 16 Streams Overview of...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online