#include<stdio.h>
#include<iostream>
#include <fstream>
#include <string>
#include<stdlib.h>
#include <windows.h>
using namespace std;
string *fileContent = NULL;
int main()
{
//init app
do
{
ifstream inFile("C:\\Users\\ur185010\\Desktop\\uuid.txt");
string *content = new string((std::istreambuf_iterator<char>(inFile)),
(std::istreambuf_iterator<char>()));
//cout << content->c_str();
bool dataChanged = false;
{
if ((fileContent == NULL) || (strcmp(fileContent->c_str(), content->c_str()) != 0))
{
cout << "updated\n";
if (fileContent) {
delete fileContent;
}
fileContent = new string(content->c_str());
dataChanged = true;
}
}
if (dataChanged) {
printf("Data Changed \n", fileContent->c_str());
// call api to parse and update data base.
}
Sleep(5000);
} while (1);
getchar();
return 0;
//inFile.open("C:\\Users\\ur185010\\Desktop\\uuid.txt");
}