文件复制新问题~
想实现dos下文件复制。为什么复制文档正确,像图片之类的东西复制后的就无法打开啊?想复制任何文件应该怎么写啊?(不用FileCopy()函数...)#include"stdio.h"
main(int argc,char *argv[])
{
FILE *in,*out;
char ch;
if(argc!=3)
{
printf("error!\n");
exit(1);
}
if((in=fopen(argv[1],"r"))==NULL)
{
printf("can't open %s.\n",argv[1]);
exit(1);
}
if((out=fopen(argv[2],"w"))==NULL)
{
printf("can't open %s.\n",argv[2]);
exit(1);
}
ch=fgetc(in);
while(!feof(in))
{
fputc(ch,out);
ch=fgetc(in);
}
fclose(in);
fclose(out);
}