Write a C++ program that asks for the URL of a PDF file, downloads it, and displays it with xpdf

Write a program named hw3pr3.cpp which asks the user for the
URL of a PDF file, checks that the URL starts with "http://" and ends with
"pdf" or "PDF", downloads it with wget, and displays it with display. To learn how these programs work, put these statements in a main to test them:

system("wget "
" -O webfile.pdf");
system("display webfile.pdf");

Running this should download that PDF file and open an X window to display it. Now write the real hw3pr3.cpp. Note: check the "Enable X forwarding" box in your Putty configuration, and start Xming before you run your program. (On a Mac you do not need Xming, you need XQuartz; Terminal will automatically launch XQuartz when it receives X11 graphics.)

Hints: To see if a string s starts with "abc" you could use
if(s[0] == 'a' && s[1] == 'b' && s[2] == 'c'). The system command expects a C-style string, so use system(s.c_str()) if s is a C++ string.
That is your homework. Where is your question?
Topic archived. No new replies allowed.