Help on a school project?

So for the past week I've been trying to make a program that tells you if an update occurs and I just barely managed to do the simplest way possible for this to work. First I was told to look up libcurl and use that to help me get the information from a website. Well... I had some trouble trying to install it and in the end I somehow downloaded curl.exe. Apparently curl.exe lets you go to the command prompt and type something like "curl www.google.com" and it gives you the source code of the website. So from there I made my program do that then take the result and dump that into a text file. Afterwards I read the text file and stored it into a vector where I compared an original vector of the source code of the website with a more current one.

But now I'm stuck I want to make it so that the program is more efficient and can actually tell you what updates. My teacher told me to somehow parse the info and use that, but I'm not sure how to do that and how that would work out. Can anyone help me with this?

And here is what I've coded so far
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <stdio.h>
#include "stdafx.h"
#include <iostream>
#include <string>
#include <time.h>
#include <vector>
#include <fstream>
using namespace std;

void sleepRoutine() //for later on when i want to automate it
{
	
}

vector<string> getInfo1()
{
	string tempLine;
	vector <string> archiveT;
	
	ifstream tempFile ("Temp.txt");
	if (tempFile.is_open())
	{	
		while (tempFile.good())
		{
			getline (tempFile, tempLine);
			archiveT.push_back(tempLine);
		}
		
	}
	return archiveT;
	
}
vector<string> getInfo2()
{
	vector <string> archiveC;
	string tempLine;
	ifstream curFile ("Current.txt");
	if (curFile.is_open())
	{

		while (curFile.good())
		{
			getline (curFile, tempLine);
			archiveC.push_back(tempLine);

		}
	}
	return archiveC;
}
bool compare(vector<string> original1 , vector<string> latest1)
{
	int x = 0;
	while (x<original1.size())
	{
		if (original1[x].compare(latest1[x])!= 0)
		{
			return true;
		}
		x++;
	}
	return false;
}
void hasUpdate()
{
	if (compare(getInfo1(), getInfo2()))
	{
		cout << "Update" << endl;
	}
	else
	{
		cout << "No update" << endl;
	}
}
int main()
{
	system("curl http://www.google.com > Temp.txt"); //dumps output from curl into a text file
	system("curl http://www.google.com > Current.txt");
	hasUpdate();
	cin.clear();
	cin.ignore(255,'\n');
	cin.get();
	return 0;

}

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
vector<string> getInfo1()
{
	string tempLine;
	vector <string> archiveT;
	
	ifstream tempFile ("Temp.txt");
	if (tempFile.is_open())
	{	
		while (tempFile.good())
		{
			getline (tempFile, tempLine);
			archiveT.push_back(tempLine);
		}
		
	}
	return archiveT;
	
}
vector<string> getInfo2()
{
	vector <string> archiveC;
	string tempLine;
	ifstream curFile ("Current.txt");
	if (curFile.is_open())
	{

		while (curFile.good())
		{
			getline (curFile, tempLine);
			archiveC.push_back(tempLine);

		}
	}
	return archiveC;
}
//----------------------------------------------------------------------------------------------------
//This could just be one function
vector<string> getInfo(char *filename)
{
	vector <string> archive;
	string tempLine;
	ifstream curFile (filename);
	if (curFile.is_open())
	{

		while (curFile.good())
		{
			getline (curFile, tempLine);
			archive.push_back(tempLine);

		}
	}
	return archive;
}
Just saying.

What do you meen by,
I want to make it so that the program is more efficient and can actually tell you what updates.
Last edited on
By more efficient I mean like something that allows me to actually use parts of the source code of the website to check if there was an update and if is an update give some kind of detail about what was update. The kinds of websites I want to really use the program for would be something like: www.mangastream.com or www.mangareader.net where it constantly has updates every few hours.
Do you know HTML? http://www.w3schools.com
You probably want some 3rd party library to parse the XML into a structure, then you can search it for information.
Last edited on
Unfortunately I don't know HTML, and I'm not sure if I can learn it in a few days to do use it for what I want, but I'll try. Also do you have any suggestions for the library to use to parse the XML.

Thank you for replying.
Sorry. I've never done XML parsing in C++. Now if you wanted it in Javascript, PHP, or Java... Anyway, just search the internet or start a new forum. However if you don't know HTML (or XML) I don't know if it will help you. You should at least read up on XML a bit if you want to know how to check for updates in web pages because that is how the information is being received from the server.
Topic archived. No new replies allowed.