- 1、本文档共10页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
文件操作只oftream和istream(File operations are only oftream and istream)
文件操作只oftream和istream(File operations are only oftream and istream)
OFSTREAM is from memory to hard disk, and ifstream is from hard disk to memory. In fact, the so-called stream buffer is memory space;
In C++, there is a class of stream, all of which are based on the I/O class, including the file I/O we want to know, stream, which has two important operators:
1, inserter (())
Output data to stream. For example, the system has a default standard output stream (cout), generally refers to the display, so, cout Write Stdout \n; said the string Write Stdout and a newline character (\n) output to the standard output stream.
2, the extractor ()
Enter data from a stream. For example, the system has a default standard input stream (CIN), which usually refers to the keyboard, so cinx is the data that reads a specified type (that is, the type of the variable x) from the standard input stream.
In C++, the operation of the file is done through the subclass fstream (file, stream) of the stream, so to manipulate the file in this way, you must add the header file fstream.h. The operation process of such files one by one.
Open file
In the fstream class, there is a member function open () that is used to open the file, and its prototype is:
Void open (const, char*, filename, int, mode, int, access);
Parameter:
Filename: the name of the file to open
Mode: the way you want to open the file
Access: open the properties of the file
The way to open a file is defined in class IOS (the base class for all streaming I/O classes), and the common values are as follows:
Ios:: app: open the file in append mode
Ios:: ate: the file is opened and positioned to the end of the file, and ios:app contains this property
Ios:: binary: open the file in binary mode. The default is text mode. The difference between the two ways is as follows
Ios:: in: the file opens as input (file data is entered into memory)
Ios:: out: the file opens as output (memory data is output to the file)
Ios:: nocreate: the file is no
您可能关注的文档
- 初中学生英语学习的需求分析方法与运用(Needs analysis and application of junior high school students' English learning).doc
- 初中语文现代文阅读课教学模式(Junior high school Chinese, modern literature reading course, teaching mode).doc
- 初二上册英语单词表(The second book of English words).doc
- 初二下册30课诗五首(The second volume 30 class five poems).doc
- 初二下英语同步辅导(English coaching in junior middle school).doc
- 初一语文学法指导(First grade Chinese pedagogy guidance).doc
- 初二物理课程总结(Physics course summary of junior middle school).doc
- 初夏诗词-小归集(Early summer Poetry - small collection).doc
- 初中文言实词汇释(Glossary of notional words in classical Chinese Junior Middle School).doc
- 初探李白的生平(The life of Li Bai).doc
- 2025AACR十大热门靶点推荐和解读报告52页.docx
- 财务部管理报表.xlsx
- 高中物理新人教版选修3-1课件第二章恒定电流第7节闭合电路欧姆定律.ppt
- 第三单元知识梳理(课件)-三年级语文下册单元复习(部编版).pptx
- 俄罗斯知识点训练课件-七年级地理下学期人教版(2024).pptx
- 课外古诗词诵读龟虽寿-八年级语文上学期课内课件(统编版).pptx
- 高三语文二轮复习课件第七部分实用类文本阅读7.2.1.ppt
- 高考物理人教版一轮复习课件第4章第3讲圆周运动.ppt
- 高考英语一轮复习课件53Lifeinthefuture.ppt
- 2025-2030衣柜行业风险投资发展分析及投资融资策略研究报告.docx
文档评论(0)