| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 541 人关注过本帖
标题:关于文件读写
取消只看楼主 加入收藏
xishui777
Rank: 2
等 级:论坛游民
帖 子:53
专家分:94
注 册:2010-8-17
结帖率:100%
收藏
已结贴  问题点数:2 回复次数:1 
关于文件读写
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
    ifstream file2("D:/test.txt");
    if(!file2)
    {
      cout<<"未打开读入文件!!!"<<endl;
      system("pause");
      return 0;
    }
    ofstream file3("D:/test2.txt");
    if(!file3)
    {
      cout<<"未打开写入文件!!!"<<endl;
      system("pause");
      return 0;
    }
    char a;
    while(file2.get(a))
      file3.put(a);
    file2.close();
    file3.close();
    system("pause");
    return 0;
}
代码为什么提示(未打开读入文件!!!)D:/test.txt文件已有
搜索更多相关主题的帖子: 文件 
2010-08-21 16:49
xishui777
Rank: 2
等 级:论坛游民
帖 子:53
专家分:94
注 册:2010-8-17
收藏
得分:0 
改了,还是不行
2010-08-21 17:45
快速回复:关于文件读写
数据加载中...
 
   



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

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