/*********************************************************************** Here is an example program that uses the Connection class to repeatedly query the user to enter a URL address, and then if a valid file is found, will display that page to the console. Use main() as an example for how to use the Connection class in your project. Feel free to modify the buffer and line string sizes, etc., as you see fit. ************************************************************************/ int main() { int size; int val; char buf[BUFSIZE]; char line[URLSIZE]; Connection conn; for(;;) //loop forever until control-C (^C) is hit to break { cout << "Enter a URL" << endl; cin.getline(line,URLSIZE); val = conn.openConnection(line); //send URL to openConnection if (val != ERROR) { while(conn.read_buf(buf) > 0) //will read all information in file { cout << " ************ BUFFER ************" << endl << buf << endl; //and display it to the screen } conn.closeConnection(); //done reading } else { cerr << "Error returned by openConnection: " << val << endl; } } return 0; }