Jump to content
Welcome, Guest
Existing user? Sign In

Sign In



Sign Up
The MatriX
  • Welcome To Ghbsys
  • CS GO Streaming Version is released. Have fun streaming while cheating!
  • Have a Payment Issue? Send us a Support ticket.
  • Make a thread if you need support or join our discord for live support.
  • Have Suggestions? Make a thread and you'll earn Ghbsys Points for implemented suggestions.
  • Join our discord to stay well connected! Don't forget to integrate your discord to the site
  • Welcome to [GHB] - GAmEhAcKbAsTaRdS Forum

    Welcome to [GHB] - GAmEhAcKbAsTaRdS Forum, like most online communities you must register to view or post in our community, but don't worry this is a simple free process that requires minimal information for you to signup. Be apart of [GHB] - GAmEhAcKbAsTaRdS Forum by signing in or creating an account.
    • Start new topics and reply to others
    • Subscribe to topics and forums to get email updates
    • Get your own profile page and make new friends
    • Send personal messages to other members.

    C++ Versions Checker


    NeoIII
     Share

    Recommended Posts

    #include <stdio.h> // Header file with the C standard input and output functions
    #include <urlmon.h> // Header file with URLDownloadToFile function
    
    #pragma comment(lib, "urlmon.lib") // This library includes the URLDownloadToFile function
    
    void main() // Our main function, cant run without this;)
    {	
    char remVer[4]; // Variable to store remote version number
    char myVer[4] = "1.0"; // Set local version number
    
    printf("Checking for newer versions...\n");
    
    // Ver.ini should have one line with the newest version (ie, 1.0)
    URLDownloadToFile(NULL, "http://www.openoneware.com/Ver.ini", "Ver.ini", 0, 0);
    
    FILE *filePtr; // Create a file pointer
    
    filePtr = fopen("Ver.ini","r"); // Open Ver.ini from same dir as our program
    
    if(filePtr != NULL) // If the INI exists
    {
    	fgets(remVer, 4, filePtr); // Read the INI data into our variable array
    	printf("Remote Version: %s\n", remVer); // Display remote version info
    	printf("Current Version: %s\n", myVer); // Display local version info
    	fclose(filePtr); // Close the file stream
    
    	if (strcmp(myVer, remVer) == 0) // If the local version is the same as the remote version
    	{
    		printf("\nYou already have the newest version\n");
    		remove("Ver.ini"); // Delete Ver.ini, we no longer need its services :)
      		}
    	else // If the local version is NOT the same as the remote version
    	{
    		printf("\nYou are running an OLD version, Updating...\n");
    		remove("Ver.ini"); // Delete Ver.ini, we no longer need its services :)
    
    		// Here we must not direct download an EXE file or antivirus Heuristics detect as virus
    		URLDownloadToFile(NULL, "http://www.openoneware.com/package.7z", "package.7z", 0, 0);
      		}
    }
    else // If the INI doesnt exist
    	printf("\nCannot locate Ver.ini");
    
    
    printf("\nPress ENTER to continue"); // Tell the user how to exit
    fflush(stdin); // Flush the standard input
    getchar(); // Wait for user to press a key
    }

    Link to comment
    Share on other sites

    • 2 years later...

    Neo and how i do Ini? can you explain more then this?

    Link to comment
    Share on other sites

    Guest
    This topic is now closed to further replies.
     Share

    • Recently Browsing   0 members

      • No registered users viewing this page.
    ×
    ×
    • Create New...