重定向
我想在C++程序中使标准输入cin和标准输出cout重定向到指定的文件,不知道能否做到? 问题点数:20、回复次数:7Top
1 楼foochow(无聊,灌水......)回复于 2005-06-03 01:01:18 得分 10
#include<fstream>
ifstream fin("input.txt"); //读入
ofstream fout("output.txt");//写入Top
2 楼mccxj(老鼠不逛街)回复于 2005-06-03 01:02:28 得分 0
#include<fstream.h>
ifstream in("input.txt"); //读入
ofstream out("output.txt");//写入
Top
3 楼mostideal(三甲)回复于 2005-06-03 17:23:47 得分 0
当然可以,如楼上的都可以了。。。Top
4 楼lucymary1982()回复于 2005-06-03 17:35:23 得分 0
of course ,why notTop
5 楼zhousqy(标准C匪徒)(甩拉,甩拉)回复于 2005-06-03 17:55:22 得分 0
>/<Top
6 楼CMyMfc(星际人生:=E.F=FlyForEver)回复于 2005-06-03 19:17:15 得分 0
重定向到另一个进程都可以Top
7 楼jiangpeng(Mr. J)回复于 2005-06-03 19:32:51 得分 10
重定向是由Shell负责,并非由进程本身负责Top




