I am trying to create a cpp file that will enable user to download the content from a web URL & stored it to a desired html file.

I am running on Linux. The program will call GNU wget CLI program to grab the content & stored it to a desired html file.

I would be using some unix command in the c++ program:
$wget -q -E -O index.html http://www.website.com | programfilename

I never done this before & I wonder how to declare the unix command in c++ program?
Any guidance how to get the ball rolling? Tks!

Recommended Answers

All 2 Replies

The "system" function in "cstdlib" should work:

#include <cstdlib>

int main()
{
    system("wget -q -E -O index.html http://www.website.com | programfilename");
    return 0;
}

Tks GuitarComet, it works!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.