#include "test.h" test::test() { } test::~test() { } int main( int argc, const char* argv[] ) { test first; if( argc < 2 ) { cout << "No search term entered" << endl; exit(1); } test t; t.run(); } void test::run() { string source[20]; string url[20]; pthread_t Thread[20]; url[0] = "http://www.artcyclopedia.com/masterscans/van-gogh-shoes-mid.html"; url[1] = "http://www.wizardofozcostumes.com/accessories_ruby_red_shoes.html"; url[2] = "http://www.fiftiesweb.com/fashion/shoes.htm"; url[3] = "http://www.stuff.co.nz/stuff/sundaystartimes/auckland/3957671a1860.html"; url[4] = "http://www.demi-pointe.com/NewFiles/swanlake.html"; url[5] = "http://www.demi-pointe.com/NewFiles/displayideas.html"; url[6] = "http://www.strength-shoes.com/order.html"; url[7] = "http://www.vroma.org/~bmcmanus/clothing.html"; url[8] = "http://www.strength-shoes.com/order.html"; url[9] = "http://www.apple.com/trailers/fox/in_her_shoes/"; url[10] = "http://www.artcyclopedia.com/masterscans/van-gogh-shoes-mid.html"; url[11] = "http://www.wizardofozcostumes.com/accessories_ruby_red_shoes.html"; url[12] = "http://www.fiftiesweb.com/fashion/shoes.htm"; url[13] = "http://www.stuff.co.nz/stuff/sundaystartimes/auckland/3957671a1860.html"; url[14] = "http://www.demi-pointe.com/NewFiles/swanlake.html"; url[15] = "http://www.demi-pointe.com/NewFiles/displayideas.html"; url[16] = "http://www.strength-shoes.com/order.html"; url[17] = "http://www.vroma.org/~bmcmanus/clothing.html"; url[18] = "http://www.strength-shoes.com/order.html"; url[19] = "http://www.apple.com/trailers/fox/in_her_shoes/"; int X=0; for(int i=0; i<20;i++) { //source[i] = t.fetchpage(url[i]); // threaded version pthread_create( &Thread[i], NULL, fetchpage, (void *)url[i].c_str()); pthread_join(Thread[i], NULL); // non-threaded verson fetchpage((void *)url[i].c_str()); } } void *test::fetchpage(void* url) { retrievepage page; string urls = (char *)url; cout << "Fetching... " << urls << endl; string source = page.getpage((char *)url); //return source; }