Update Function

What I'm doing, is having a button ( button2 ) check for the file version online, and if the value matches then having it tell a label ( label1 ) to change it's text and forecolor. My issue is, regardless of the text on the defined file, it always reacts as if theres an update. My Code :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
void Form3::button2_Click(System::Object^  sender, System::EventArgs^  e)
{
	string ProgramVer = "40";
	string WebVer;
	ifstream UpdateFile, FileURL;
	UpdateFile.open("http://ughzanime.tk/Quil/Update.txt");
	getline(UpdateFile, WebVer, ';');
	UpdateFile.close();

	if(WebVer != ProgramVer)
	{	
		label1->ForeColor = System::Drawing::Color::Lime;
		label1->Text = "An update was found!";
		int  nUpdate = ::MessageBox(NULL, "There is an update available, would you like to download it?",  "Update Found", MB_ICONEXCLAMATION|MB_YESNO); 
		{
			if (nUpdate == IDYES)
			{
				 System::Diagnostics::Process::Start("http://www.ughzanime.tk/Quil/Download/Quil.dll");
			}
		}
	}
	else
	{
		label1->ForeColor = System::Drawing::Color::Maroon;
		label1->Text = "No Update Found...";
	}
}


I'm using ' ; ' as a deliminator to scan for the line with the program version.
Last edited on
Bump
I don't think the ifstream can deal with online files like that. Use 'is_open()' to check whether that file could be opened.

I don't think either that a dll could be started as a process. It'd surprise me if you could start a processes remotely that way
The shell execution command isn't to open the file, rather it just downloads it ( The Update ), my issue standing is that it always states that theres an update even when the defined file has a value stating otherwise,
Have you given a thought to using sockets or curl to do the online check?
Can you give me an example of how that would work?
Libcurl has some examples. This one grabs a file from remote url and stores it in memory (which sort of sounds like what you want)

http://curl.haxx.se/libcurl/c/getinmemory.html
Topic archived. No new replies allowed.