Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * importDesc.c
- * by Reisyukaku
- */
- #include <stdio.h>
- #include <stdlib.h>
- int main(int argc, char** argv){
- if(argc != 4){
- printf("usage: %s [txt file] [descriptor file] [num]\n", argv[0]);
- return -1;
- }
- FILE* txt = fopen(argv[1], "r");
- FILE* desc = fopen(argv[2], "rb+");
- if(!txt || !desc){
- printf("Error opening file.\n");
- return -1;
- }
- fseek(txt, 0, SEEK_END);
- int size = ftell(txt);
- unsigned char* text = calloc(size + 1, sizeof(unsigned char));
- fseek(txt, 0, SEEK_SET);
- fread(text, 1, size, txt);
- fseek(desc, 0x8 + (strtol(argv[3], NULL, 10) * 0xC8), SEEK_SET);
- fwrite(text, 1, size, desc);
- fclose(txt);
- fclose(desc);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement