博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
freopen的使用
阅读量:4038 次
发布时间:2019-05-24

本文共 284 字,大约阅读时间需要 1 分钟。

freopen可以代替在黑框中的输入输出

#include
using namespace std;int main(){ freopen("1.in.txt","r",stdin); freopen("1.out.txt","w",stdout); int a,b; cin>>a>>b; cout<
<

freopen()中的文件1.in.txt和1.out.txt要跟主文件在同一个目录下。

fclose()有两个好处:

(1)将缓存区中的内容立刻刷到磁盘文件里,避免文件没有写入;

(2)释放文件指针。

转载地址:http://xosdi.baihongyu.com/

你可能感兴趣的文章
[LeetCode By Python]122. Best Time to Buy and Sell Stock II
查看>>
[LeetCode By Python]125. Valid Palindrome
查看>>
[LeetCode By Python]136. Single Number
查看>>
[LeetCode By MYSQL] Combine Two Tables
查看>>
[Leetcode BY python ]190. Reverse Bits
查看>>
Android下调用收发短信邮件等(转载)
查看>>
Android中电池信息(Battery information)的取得
查看>>
SVN客户端命令详解
查看>>
Android/Linux 内存监视
查看>>
Linux系统信息查看
查看>>
用find命令查找最近修改过的文件
查看>>
Android2.1消息应用(Messaging)源码学习笔记
查看>>
Phone双模修改涉及文件列表
查看>>
android UI小知识点
查看>>
Android之TelephonyManager类的方法详解
查看>>
android raw读取超过1M文件的方法
查看>>
ubuntu下SVN服务器安装配置
查看>>
MPMoviePlayerViewController和MPMoviePlayerController的使用
查看>>
CocoaPods实践之制作篇
查看>>
[Mac]Mac 操作系统 常见技巧
查看>>