Skip to content

Instantly share code, notes, and snippets.

@nestedbytes
Created July 6, 2022 12:57
Show Gist options
  • Save nestedbytes/6330a5192a26cf5f498f0450546302ae to your computer and use it in GitHub Desktop.
Save nestedbytes/6330a5192a26cf5f498f0450546302ae to your computer and use it in GitHub Desktop.
Updater for a c app

So to make it work first of all make a github repo and then make a new file called "version.txt" open it and type the version of ur app then use the raw url of the file and put it here in updater.c:

system("powershell Invoke-WebRequest <url>  -OutFile C:/Windows/Temp/version.txt");

Then when u wanna update change the version.txt to another version like 1.1.0 that will cause the app to think is outdated Full github repo here https://github.com/shourgamer2/C-Updater-Win

#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void main( int argc, char **argv) {
system("powershell Invoke-WebRequest https://raw.githubusercontent.com/shourgamer2/C-Updater-Win/main/version.txt -OutFile C:/Windows/Temp/version.txt");
FILE *f2 = fopen("C:/Windows/Temp/version.txt","r");
char line[BUFSIZ];
while (fgets(line, sizeof line, f2)) {
if (strstr(line, "1.0.0")) {
printf("You are in correct version !\n");
}
else{
printf("Outdated ! Go to https://github.com/shourgamer2/C-Updater-Win");
system("start https://github.com/shourgamer2/C-Updater-Win ");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment