| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1377 人关注过本帖
标题:我的文件输入与输出怎么打不开呢?
取消只看楼主 加入收藏
泾水荣梦
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
快速回复:我的文件输入与输出怎么打不开呢?
数据加载中...
 
   



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

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