Created
February 24, 2020 18:56
-
-
Save ariedro/792aa9505637a51c9f24ec4f536bcc3f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # include <stdio.h> | |
| # include <stdlib.h> | |
| int main (int argc, char* argv[]) { | |
| if(argc < 3) { | |
| printf("Usage: offseter [FILE] [OFFSET]\n"); | |
| return 1; | |
| } | |
| unsigned char offset = atoi(argv[2]); | |
| FILE *fi, *fo; | |
| unsigned char c; | |
| fi = fopen(argv[1], "r"); | |
| if(!fi) { | |
| printf("%s: No such file or directory\n", argv[1]); | |
| return 1; | |
| } | |
| fo = fopen("out.txt", "w"); | |
| while(!feof(fi)) { | |
| c = fgetc(fi); | |
| fputc(c + offset, fo); | |
| } | |
| fclose(fi); | |
| fclose(fo); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment