fstream的参数
时间: 2023-10-12 12:04:59 浏览: 76
为了使用fstream类,需要将其对应的头文件包含到你的cpp文件中。fstream有两个派生类,即ifstream和ofstream,分别对应输入文件流和输出文件流。创建一个对象后,可以调用该对象的open函数来打开文件。open函数有两个参数,第一个参数是字符串,表示文件的地址,第二个参数是打开方式,如ios::in代表输入流打开,ios::out代表输出流打开。在ifstream对象中,可以使用seekg函数来定位读取位置,在ofstream对象中,可以使用seekp函数来定位写入位置。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [C++流操作之fstream用法介绍](https://blog.csdn.net/weixin_32157619/article/details/112825788)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [C++中fstream,ifstream及ofstream用法浅析](https://download.csdn.net/download/weixin_38651661/13991820)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [初学C++ fstream](https://blog.csdn.net/weixin_39890332/article/details/111490388)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文