fork download
  1. #include<stdio.h>
  2. #include<windows.h>
  3. int main(void){
  4. /*Delete changelog.txt*/
  5. FILE *plik;
  6. remove("changelog.txt");
  7. /*Print text and flush*/
  8. printf("Downloading changelog.txt...\n\n");
  9. fflush(stdout);
  10. /*Determine if there's wget.exe, if not, exit, else download changelog.txt*/
  11. if ((plik=fopen("wget.exe", "r"))==NULL){
  12. printf("wget.exe not found. Please obtain it and rerun Updater.\n\n");
  13. fflush(stdout);
  14. fclose(plik);
  15. exit(1);
  16. } else {
  17. fclose(plik);
  18. system("wget.exe http://o...content-available-to-author-only...t.com/changelog.txt -q");
  19. printf("Downloaded.\n\n");
  20. fflush(stdout);
  21. }
  22. /*Parse the changelog.txt*/
  23. double a;
  24. plik = fopen("changelog.txt","r");
  25. fscanf(plik, "%lf",&a);
  26. fclose(plik);
  27. int newver = a*1000 + 0.5;
  28. /*Print text and flush*/
  29. printf("Newest version: %i\n\n",newver);
  30. fflush(stdout);
  31. printf("Checking current version of OBS...\n\n");
  32. fflush(stdout);
  33. /*Check current version of OBS by parsing global.ini*/
  34. char *appdata = getenv("APPDATA");
  35. char *path1 = malloc(250);
  36. snprintf(path1,249,"%s/OBS/Global.ini",appdata);
  37. int currver = GetPrivateProfileInt("General","LastAppVersion","error while reading",path1);
  38. free(path1);
  39. /*Convert decimal to hexadecimal*/
  40. char hx[256];
  41. int decVal = currver;
  42. sprintf(hx,"%x",decVal);
  43. /*Print text and flush*/
  44. printf("Current version: %s\n\n",hx);
  45. fflush(stdout);
  46. int x = atoi(hx);
  47. /*Compare versions*/
  48. if (newver > x){
  49. /*Download newest version*/
  50. printf("Update available!\n\n");
  51. fflush(stdout);
  52. /*system("wget.exe http://s...content-available-to-author-only...e.net/projects/obsproject/files/latest/download -q");
  53.   printf("Downloaded.");
  54.   fflush(stdout);*/
  55. } else {
  56. /*Print text and flush*/
  57. printf("OBS up to date!\n\n");
  58. fflush(stdout);
  59. }
  60. printf("Press any key to continue...\n\n");
  61. fflush(stdout);
  62. return 0;
  63. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty