文件复制问题~
想实现DOS下实现文件复制,各位刚忙看看哪错了。总是打不开第一个要复制的文件。#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);
}
[ 本帖最后由 human84 于 2010-2-5 23:38 编辑 ]