#include void main(int argc, char * argv[]) { FILE * infile; FILE * outfile; char byte; int offset; if(argc!=5) { printf("Sintassi: CRYPT nomefile-input nomefile-output operation offset\n"); return; } infile=fopen(argv[1], "r"); if(infile==NULL) { printf("Impossibile aprire in lettura il file [%s]\n", argv[1]); return; } outfile=fopen(argv[2], "w"); if(outfile==NULL) { printf("Impossibile aprire in scrittura il file [%s]\n", argv[2]); return; } offset = atoi(argv[4]); while(!feof(infile)) { byte=fgetc(infile); /* byte=getc(); */ if(byte == EOF) break; if(argv[3][0]=='c') byte+=offset; else if(argv[3][0]=='d') byte-=offset; fputc(byte, outfile); } fclose(infile); fclose(outfile); }