加密文件程序,错误如下,帮忙看下
#include<stdio.h>#include<stdlib.h>
void main(int argc,char*argv[]) //argc为整数,argv 为指针的指针
{
FILE *fp1,fp2;
char c,ch;
long j;
if(argc!=3)exit(0);
fp1=fopen(argv[1],"rb"); //打开文件供读
fp2=fopen(argv[2],"wb"); //打开文件供写
if((fp1==NULL)||(fp2==NULL))
{
printf("cannot open file\n");
exit(1);
}
printf("请输入密码:");
scanf("%i",&j);
srand(j); //初始化随机数发生器
ch=fgetc(fp1); //ch为文件字符流
while(!feof(fp1))
{
c=rand(); //c为随机字符流
ch=ch^c; //异或加密
fputc(ch,fp2);
ch=fgetc(fp1);
}
fclose(fp1);
fclose(fp2);
exit(0);
}
----------------
构建中止 未命名1: 4 个错误, 2 个警告----配置: mingw5 - CUI Debug, 编译器类型: MinGW--------------------
检查文件依赖性...
正在编译 C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp...
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:10: error: no match for 'operator=' in 'fp2 = fopen(((const char*)(*(argv + 8u))), ((const char*)"wb"))'
[Warning] D:\C-FREE~1\mingw\include\stdio.h:130: note: candidates are: _iobuf& _iobuf::operator=(const _iobuf&)
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:11: error: no match for 'operator==' in 'fp2 == 0'
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:24: error: cannot convert `FILE' to `FILE*' for argument `2' to `int fputc(int, FILE*)'
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:28: error: cannot convert `FILE' to `FILE*' for argument `1' to `int fclose(FILE*)'
[Warning] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:30:2: warning: no newline at end of file
构建中止 未命名1: 4 个错误, 2 个警告