标题:关于文件读写
取消只看楼主
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



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




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

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