Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "string.h"
- int main(int argc, char *argv[]) {
- FILE *file =fopen("file", "r");
- FILE *szyfr_file;
- printf(argv[1]);
- char *haslo;
- scanf("%s",haslo);
- int znak;
- char tymczasowy[6];
- tmpnam(tymczasowy);
- char *tymczasowyptr;
- strcpy(tymczasowy,tymczasowyptr);
- if (NULL==(szyfr_file=fopen(tymczasowy,"wb"))) return 2;
- if (NULL==(file=fopen(argv[1],"rb"))) return 1;
- for (int j =0 ;znak != EOF;j++){
- znak = fgetc(file);
- int zaszyfrowany_znak =znak ^ haslo[ j % (strlen(haslo)) ];
- fputc(zaszyfrowany_znak,szyfr_file);
- }
- fclose(file);
- fclose(szyfr_file);
- unlink(argv[1]);
- rename(tymczasowyptr,argv[1]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement