1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> char* key = "0123456789"; int main(void) { char name[256]; char name1[256]; printf("ÀÔ·Â ÆÄÀÏ À̸§: "); scanf("%s", name); printf("Ãâ·Â ÆÄÀÏ À̸§: "); scanf("%s", name1); FILE* f1 = fopen(name, "r+b"); FILE* f2 = fopen(name1, "w+b"); fseek(f1, 0, SEEK_END); long length = ftell(f1); char* p = (char*)malloc(length*sizeof(char)); fseek(f1, 0, SEEK_SET); fread(p, sizeof(char), length, f1); for (unsigned long i = 0; i < length; i++) { p[i] ^= key[i % 10]; } fwrite(p, sizeof(char), length, f2); free(p); fclose(f1); fclose(f2); return 0; } | cs |