Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <string.h>
- int main(int argc, char* argv[]){
- FILE *f1 = fopen(argv[1], "r"), *f2 = fopen("plikwy","w");
- int param = atoi(argv[2]);
- if(argc < 3){
- printf("BLAD ILOSCI PARAMETROW\n");
- return 1;
- }
- if (access(argv[1],R_OK) != 0){
- printf("BLAD DOSTEPU DO PLIKU WEJSCIOWEGO");
- return 1;
- }
- if(f1 == NULL){
- perror("BLAD OTWARCIA PLIKU\n");
- return 1;
- }
- int ch;
- while(1) {
- ch = fgetc(f1);
- if (ch == EOF)
- break;
- fprintf(f2,"%c",ch+param);
- }
- fclose(f1);
- fclose(f2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement