高手帮忙啊,在线=

applecjn 2003-09-11 10:31:43
#include<fstream.h>
#include<stdlib.h>
//using namespace std;

void main()
{
ofstream fout;
system("copy e:\apple.txt e:\apple1.txt");
fout.open("apple.txt");
}


目的是把apple.txt复制到apple1.txt
并删掉apple.txt

可是不能实现啊,帮忙看看啊
...全文
26 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
l1ul1u 2003-09-12
  • 打赏
  • 举报
回复
system("copy e:\apple.txt e:\apple1.txt");
要写成这样吧
system("copy e:\\apple.txt e:\\apple1.txt");
applecjn 2003-09-12
  • 打赏
  • 举报
回复
#include<fstream.h>
#include<stdlib.h>
//using namespace std;

void main()
{
ofstream fout;
system("copy apple.txt apple1.txt");
fout.open("apple.txt");
}
就行了,只要和你的cpp文件在同一目录下不用打e:的
我这里就能实现
applecjn 2003-09-11
  • 打赏
  • 举报
回复
具体该怎么弄啊
谢谢了
hanker9608 2003-09-11
  • 打赏
  • 举报
回复
我记得TC里面有个函数叫REMOVE的,可以实现文件的移动,如果原文件和目标文件目录相同的话就实现了改名

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧