#include <iostream>
#include <string>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
usingnamespace std;
int main()
{
int i;
string found;
string str;
string detailnumber;
string detailsearch;
string killarray [150];
string debug;
//GET SYSTEM ID FOR ZKILLBOARD
cout << "Enter the Zkillboard.com system ID" << endl;
string boardloc;
cin >> boardloc;
string a = "http://zkillboard.com/system/";
string b = "/kills/";
string actloc = a+boardloc+b;
string wget = "wget "+actloc;
//GET FILES FOR THAT SYSTEM
//*system(wget); Well this is broken too. *//
fstream master;
master.open ("index.html");
while (master.good()) //Where do we go now, sweet child, where do we go now , owah ah ah ah ah ah aaah
{
getline(master,debug);
cout << debug << endl; //from here all the shit happens
}
return 0;
}
okay so, when we get line into debug (will later be something else) we need to search for "detail/*" and send whatever comes between detail/ and the next "/" to another string so we can use it later.
also I'm using wget to avoid having to touch an in code version, just calling system wget is way easier (even if it doesn't work at the minute, although if you want to let me know where I'm fucking up with that I can fix that too)
I've attempted to get boost to play nice with codeblocks but I'm being shit and it's just not working (Read tutorials, watched walk throughs and just wound up with crazy ass errors that nobody else seemed to get)
I believe std::string.find ( http://cplusplus.com/reference/string/string/find/ ) is what you're looking for:
1 2 3 4
size_t start = debug.find("detail/", 0); //get start of substring position
size_t end = debug.find("/", start+8); // "detail/" is 7 characters, so look for first / after that
std::string detail_txt(debug, start, end-start); //string constructor from substring
It may be worth checking if start or end == std::string::npos, to make sure both are actually found.
Any more information can be found in the <string> reference: