1 / 23

Lecture 27

Lect 27P. 2. Winter Quarter. Stream I/O Library Header Files. Note:There is no .h" on standard header files.Be careful about using namespace std"iostream -- contains basic information required for all stream I/O operationsiomanip -- contains information useful for performing formatte

fabrizio
Download Presentation

Lecture 27

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. Lect 27 P. 1 Winter Quarter I/O Manipulation Lecture 27 Instructor notes: Lecture 27 deals with I/O Manipulation, in particular how to have more control over input and output than the basic cin and cout provide. We will look at stream manipulators, format state flags, and I/O stream member functions. Instructor notes: Lecture 27 deals with I/O Manipulation, in particular how to have more control over input and output than the basic cin and cout provide. We will look at stream manipulators, format state flags, and I/O stream member functions.

    2. Lect 27 P. 2 Winter Quarter Stream I/O Library Header Files Note: There is no “.h” on standard header files. Be careful about “using namespace std” iostream -- contains basic information required for all stream I/O operations iomanip -- contains information useful for performing formatted I/O with parameterized stream manipulators fstream -- contains information for performing file I/O operations strstream -- contains information for performing in-memory I/O operations (i.e., into or from strings in memory) Instructor notes: Since this is starting a new lecture...it’s probably a good idea to remind people that header files in C++ do not require the “.h” extension and that to avoid (in an ANSI C++ strict environment) prefixing standard objects with “std::”, they need to indicate that the standard namespace is being used. We begin with an overview of the I/O library header files. iostream is the header file needed for all stream I/O iomanip lets us control I/O better by making stream manipulators available fstream lets us do file I/O strsteam lets us perform operations on strings that are already in memory Instructor notes: Since this is starting a new lecture...it’s probably a good idea to remind people that header files in C++ do not require the “.h” extension and that to avoid (in an ANSI C++ strict environment) prefixing standard objects with “std::”, they need to indicate that the standard namespace is being used. We begin with an overview of the I/O library header files. iostream is the header file needed for all stream I/O iomanip lets us control I/O better by making stream manipulators available fstream lets us do file I/O strsteam lets us perform operations on strings that are already in memory

    3. Lect 27 P. 3 Winter Quarter Classes for Stream I/O in C++ ios is the base class. istream and ostream inherit from ios ifstream inherits from istream (and ios) ofstream inherits from ostream (and ios) iostream inherits from istream and ostream (& ios) fstream inherits from ifstream, iostream, and ofstream

More Related