ENCRYPTION
[ragava@localhost ~]$ cat ec.c
#include<stdio.h>
main(int argc, char *argv[])
{
int i;
char a[2000],b;
FILE *fp;
if(argc!=2)
{
printf("Usage error");
return;
}
fp=fopen(argv[1],"r");
if(fp==NULL)
{
printf("ERROR IN OPENING A FILE");
return;
}
for(i=0,a[i]=getc(fp);feof(fp)!=0;a[++i]=getc(fp))
;
a[i]='\0';
fclose(fp);
remove(argv[1]);
fp=fopen(argv[1],"w");
for(i=0;a[i]!='\0';i++)
{
b=a[i]+2;
putc(b,fp);
}
fclose(fp);
}
No comments:
Post a Comment