bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] Calling wget programmatically from C/C++ code


From: Micah Cowan
Subject: Re: [Bug-wget] Calling wget programmatically from C/C++ code
Date: Wed, 23 Jun 2010 11:43:46 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4

On 06/23/2010 03:14 AM, Chitra Nanda wrote:
> Hi,
> 
> I want to know if I can call wget programmatically from c/c++ program. I
> don't want to use system(wget). That will
> cause portability issues for me. I would need that to work on all platforms.

system() is portable to all platforms: it is a part of the C and C++
standards, and is in fact the only portable way to do as you request.
However, it doesn't provide you with the output that came from wget
(directly; you could redirect to a file and parse that), and blocks
until wget is finished. This may make it less desirable for you to use,
in which case you'll most likely have to write an interface yourself
that does what you want, and implement it using platform-specific code
on whichever platforms you wish to support.

> Since it is not part of any lib*.so I cannot load it dynamically at run time
> either.
> 
> Is there any way in which I can use functions/APIs of wget and call them
> directly from C/C++ code. Will that work. Can you please suggest.

There's no portable way to do that.

-- 
Micah J. Cowan
http://micah.cowan.name/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]