C毕业论文外文翻译.doc
文本预览下载声明
2012年毕业设计论文英汉互译部分
Chapter 8. The IO Library
In C++, input/output is provided through the library. The library defines a family of types that support IO to and from devices such as files and console windows. Additional types allow strings to act like files, which gives us a way to convert data to and from character forms without also doing IO. Each of these IO types defines how to read and write values of the built-in data types. In addition, class designers generally use the library IO facilities to read and write objects of the classes that they define. Class types are usually read and written using the same operators and conventions that the IO library defines for the built-in types.
This chapter introduces the fundamentals of the IO library. Later chapters will cover additional capabilities: HYPERLINK mk:@MSITStore:C:\\Users\\Administrator\\Desktop\\C++%20Primer.chm::/0201721481/ch14.html \l ch14 Chapter 14 will look at how we can write our own input and output operators; HYPERLINK mk:@MSITStore:C:\\Users\\Administrator\\Desktop\\C++%20Primer.chm::/0201721481/app01.html \l app01 Appendix A will cover ways to control formatting and random access to files.
Our programs have already used many IO library facilities:
istream (input stream) type, which supports input operations
ostream (output stream) type, which provides output operations
cin (pronounced see-in) an istream object that reads the standard input.
cout (pronounced see-out) an ostream object that writes to the standard output
cerr (pronounced see-err) an ostream object that writes to the standard error. cerr is usually used for program error messages.
operator , which is used to read input from an istream object
operator , which is used to write output to an ostream object
getline function, which takes a reference to an istream and a reference to a string and reads a word from the istream into the string
This chapter looks briefly at some additional IO operations, and discusses support for
显示全部