Problems with wget and system(gv)

Hello,I need to write a program which asks the user for the
URL of a PDF file, checks that the URL starts with "http", downloads it with wget, and displays it with gv. The output is that it downloads the specified pdf, but the display is unable to open and I am clueless as to why. Here is the code.


#include "std_lib_facilities_4a.h"
#include <cstdlib>

int main()
{
cout<<"Hello, please enter your URL starting with 'http'. \n";
string url;
cin>>url;
string http ="http";
string pdf = "pdf";

//delete after completion
cout<<url<<'\n';
//*********************

int x;
int y;
for(int i=0; i<4; i++)
{
if(url[i] == http[i])
{
x+=1;
}
}

if (x==4)
system("wget url -O webfile.pdf");
system("gv webfile.pdf");

if (x!=4)
simple_error("Please start the URL with 'http' \n");


}
Topic archived. No new replies allowed.