[新手求教]拷贝文件的代码,有和错误?
照着书本码字的代码,为何无法编译?Pelles C里编译时提示下列内容:
Project build started
Project build ended in complete failure
<程序代码如下>
//使用命令行参数拷贝文件
#include <stdio.h>
int main(int argc, char *argv[])
{
FILE *in, *out;
int c;
if( argc ! = 3) //如果命令行给的参数数量不对
{
fprintf(stderr,"Need two files names\n");
return 1;
}
if ( (in = fopen(argv[1],"r")) == NULL )
{
fprintf(stderr, "Can't read %s.\n", argv[1]);
return 2;
}
if ( (out = fopen(argv[2], "w")) == NULL )
{
fprintf(stderr, "Can't write %s.\n", argv[2]);
return 3;
}
while ( (c = getc(in)) != EOF )
putc(c, out);
printf("File has been copied.\n");
fclose(in);
fclose(out);
return 0;
}