Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.c
- // Hearthstone Configurator
- //
- // Created by Tomasz Kaczmarzyk on 09.10.2016.
- // Copyright � 2016 Tomasz Kaczmarzyk. All rights reserved.
- //
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- void editFile(char *options)
- {
- if (access(options, F_OK) != -1)
- {
- FILE *optionsFile = fopen(options, "r+"); //w to clear
- printf("File exist. Let's do this!\n");
- char buf[1000];
- int a;
- while (fgets(buf, 1000, optionsFile) != NULL)
- {
- printf("%s and place in buf%d\n", buf, a);
- a++;
- }
- //fputs(&buf[i], optionsFile);
- //printf("Propably cleared file\n");
- fclose(optionsFile);
- }
- else
- {
- printf("File does not exist, please install Hearthstone\n");
- }
- }
- int main() {
- char *directory;
- /*
- struct passwd *passwdEnt = getpwuid(getuid());
- char *home = passwdEnt->pw_dir;
- char justValue;
- while (justValue != "1" | justValue != "2")
- {
- printf("Choose your OS\nPlease choose the real one\n1. Windows\n2. MacOS\n");
- justValue = getchar();
- if(justValue == '1')
- {
- directory = "\aAppData\aLocal\aBlizzard\aHearthstone\aoptions.txt";
- break;
- }
- else if (justValue == '2')
- {
- directory = "/Library/Preferences/Blizzard/Hearthstone/optionsz.txt";
- break;
- }
- else
- {
- printf("Please choose correct number\n");
- }
- }
- */
- directory = "/storage/emulated/0/Android/data/com.blizzard.wtcg.hearthstone/files/options.txt";
- //scanf("%s", directory);
- //printf("%s", directory);
- //sprintf(finalDirectory, "%s%s", &home, &directory);
- //strcat(home, directory);
- editFile(directory);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement