Advertisement
erzis

Untitled

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