#include<stdio.h>
main()
{
FILE *fp;
unsigned char ch1,ch2;
if((fp=fopen("stud.dat","rb+"))==NULL)
exit(1);
ch2=24;
ch1=fgetc(fp);
while(!feof(fp))
{
printf("%c",ch1);
ch1=ch1^ch2;
fseek(fp,-1L,1);//指针回移1个字节
fputc(ch1,fp);
//将加密后的结果写回
fseek(fp,1L,1);//跳过第奇数个字节
ch1=fgetc(fp);
}
fclose(fp);
}