I am supposed to extract timestamps from the following XML document. However, what I've created so far extracts the timestamps in addition to the code before them, when I just want the timestamps. Could someone please point out what I'm doing wrong? Thanks in advance!
XML document: http://pastebin.com/JuzHgcmR
#include <iostream> #include <string> #include <fstream> using namespace std; int main() { string tempStr; ifstream inFile; ofstream outFile; outFile.open("Outputdata.txt"); inFile.open("Groupproject.xml"); if (inFile.fail()) { cout << "Error Opening File" << endl; system("pause"); exit(1); } while (inFile) { inFile >> tempStr; if (tempStr.find('Z\"') != string::npos) { cout << "Found timestamp" << tempStr; outFile << tempStr << endl; cout << "Copied to file" << endl; } } inFile.close(); outFile.close(); system("pause"); return 0; }
No comments:
Post a Comment