Advertisement
erzis

Untitled

Oct 14th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. //
  2. // main.c
  3. // Hearthstone Configurator
  4. //
  5. // Created by Tomasz Kaczmarzyk on 09.10.2016.
  6. // Copyright � 2016 Tomasz Kaczmarzyk. All rights reserved.
  7. //
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <unistd.h>
  11.  
  12. void editFile(char *options)
  13. {
  14. if (access(options, F_OK) != -1)
  15. {
  16. FILE *optionsFile = fopen(options, "r+"); //w to clear
  17. printf("File exist. Let's do this!\n");
  18. char buf[1000];
  19. int a;
  20. while (fgets(buf, 1000, optionsFile) != NULL)
  21. {
  22. printf("%s and place in buf%d\n", buf, a);
  23. a++;
  24. }
  25. //fputs(&buf[i], optionsFile);
  26. //printf("Propably cleared file\n");
  27. fclose(optionsFile);
  28. }
  29. else
  30. {
  31. printf("File does not exist, please install Hearthstone\n");
  32. }
  33.  
  34. }
  35.  
  36. int main() {
  37. char *directory;
  38. /*
  39. struct passwd *passwdEnt = getpwuid(getuid());
  40. char *home = passwdEnt->pw_dir;
  41. char justValue;
  42. while (justValue != "1" | justValue != "2")
  43. {
  44.  
  45. printf("Choose your OS\nPlease choose the real one\n1. Windows\n2. MacOS\n");
  46. justValue = getchar();
  47. if(justValue == '1')
  48. {
  49. directory = "\aAppData\aLocal\aBlizzard\aHearthstone\aoptions.txt";
  50. break;
  51. }
  52. else if (justValue == '2')
  53. {
  54. directory = "/Library/Preferences/Blizzard/Hearthstone/optionsz.txt";
  55. break;
  56. }
  57. else
  58. {
  59. printf("Please choose correct number\n");
  60. }
  61. }
  62. */
  63. directory = "/storage/emulated/0/Android/data/com.blizzard.wtcg.hearthstone/files/options.txt";
  64. //scanf("%s", directory);
  65. //printf("%s", directory);
  66. //sprintf(finalDirectory, "%s%s", &home, &directory);
  67. //strcat(home, directory);
  68. editFile(directory);
  69. return 0;
  70.  
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement