utos.c (935B)
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 /* 5 Copyright (c) 2020 Devine Lu Linvega 6 7 Permission to use, copy, modify, and distribute this software for any 8 purpose with or without fee is hereby granted, provided that the above 9 copyright notice and this permission notice appear in all copies. 10 11 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 WITH REGARD TO THIS SOFTWARE. 13 */ 14 15 typedef unsigned char Uint8; 16 typedef signed char Sint8; 17 typedef unsigned short Uint16; 18 typedef signed short Sint16; 19 20 int 21 main(int argc, char **argv) 22 { 23 FILE *f; 24 Uint8 *buffer; 25 Uint16 filelen, i; 26 if(argc < 2 || !(f = fopen(argv[1], "rb"))) 27 return 1; 28 fseek(f, 0, SEEK_END); 29 filelen = ftell(f); 30 rewind(f); 31 buffer = (Uint8 *)malloc(filelen * sizeof(Uint8)); 32 fread(buffer, filelen, 1, f); 33 fclose(f); 34 for(i = 0; i < filelen; ++i) 35 buffer[i] += 0x80; 36 printf("\n\n"); 37 fwrite(buffer, filelen, 1, fopen(argv[2], "wb")); 38 return 0; 39 }