#include<cstdlib> [...] char charQuote = '\"'; string theURL = "http://127.0.0.1/index.html"; string outputFile = ".wet.html"; string cmd = "wget --quiet -O " + outputFile + " " + charQuote + theURL + charQuote; int status = system(cmd.c_str());
#include<unistd.h> [...] unlink(outputFile.c_str());
#include<iostream> #include "url.h" int main(int argc, char** argv) { using namespace std; if (argc < 2) { cerr << "missing arg on cmd line" << endl; return 1; } URL url(argv[1]); url.download(); string theLink = url.getNextLink(); while(theLink.size() > 0) { cout << theLink << endl; theLink = url.getNextLink(); } return 0; }Run the program
./urldriver http://www.enseignement.polytechnique.fr/profs/informatique/Leo.Liberti/test.htmland verify that the output is
http://www.enseignement.polytechnique.fr/profs/informatique/Leo.Liberti/test3.html http://www.enseignement.polytechnique.fr/profs/informatique/Leo.Liberti/test2.html