Wget Doesn't Work

I've been tackling this code for the past several hours and I've hit upon a snag when attempting to use wget from the command line. As I understand it, using the 'system' function is supposed to inject whatever the argument is into the command line, but it doesn't work for some reason( No file is grabbed, in this case ).

Additional Info;
1) Simple_window is a class that creates a GUI interface for my project
2) Pic_window opens another window when a picture file is opened
3) Check_prefix and Try_again let the user recover from bad input (unsupported extensions, doesn't start with 'http://', etc.
4) Wget's argument in this case would be the string in the input box labeled 'Get from web'
5) Wget_ext return whatever extension the input string ends with.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  void Simple_window::Wget(const string& name)//gets file from internet and displays it
{
	string url = name;
	

    while(true)
{
    if(!Check_prefix(url))
        break;

    if(!Try_again(url))
        break;

    if(Wget_ext(url) == ".jpg") // I can't get this to work 
	{
	   size_t pos = url.rfind("/");

       string name = url.substr(pos+1);

       string command = "wget " + url;

       system(command.c_str());

	   Image mypic(Point(50,50), name); //'name'is the name of the file from which the image is displayed     
           Picture_window pwin(Point(100,100), 600, 400, "Picture Window");
	   pwin.attach(mypic);
	   Fl::redraw();
	   pwin.wait_for_button();


	}

	else if(Wget_ext(url) == ".gif") //haven't modified these statements yet
	{
		command = "wget " + url + " -O webfile.gif";
		display = "display webfile.gif";
	}

	else
	{
		command = "wget " + url + " -O webfile.jpeg";
		display = "display webfile.jpeg";
	}

	break;

}
}
Last edited on
Topic archived. No new replies allowed.