标题:我的文件输入与输出怎么打不开呢?
取消只看楼主
泾水荣梦
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2005-6-3
 问题点数:0 回复次数:2 
我的文件输入与输出怎么打不开呢?

#include<iostream> #include<fstream> #include<string> #include<cstdlib> //#include"in_file" //#include"out_file"

using namespace std;

int main() { ofstream outfile; ifstream infile; infile.open("income.com"); outfile.open("tax.out"); if(!outfile) { cerr<<"error:unable to open output file!\n"; return -2; } if(!infile) { cerr<<"error:unable to open input file!\n"; return -1; }

string word; while(infile>>word) outfile<<word<<' '; infile.close(); outfile.close(); return 0; } 运行时总是说 unable to open input file 各位可否告诉我是怎么回事呢?

搜索更多相关主题的帖子: include infile open 文件 
2005-06-03 23:48
泾水荣梦
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2005-6-3
得分:0 
我知道啊
都在一个文件夹中 啊

真小人和伪君子 从来只有勾结 用合作只会玷污这个词眼
2005-06-08 16:42
泾水荣梦
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2005-6-3
得分:0 
多谢指教

真小人和伪君子 从来只有勾结 用合作只会玷污这个词眼
2005-06-15 10:22



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-20043-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.531275 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved