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: Keisial
Subject: Re: [Bug-wget] Calling wget programmatically from C/C++ code
Date: Fri, 25 Jun 2010 00:11:17 +0200
User-agent: Thunderbird

Micah Cowan wrote:
> 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.
>   
popen() is also portable.
However, both system() and popen() can give portability issues escaping
input.
Although in case of escaping just a url for wget, you can enclose it in
double
quotes (to escape ampersands) and %-escape any other shell-sensitive
character.


Chitra Nanda:
> I want the same piece of code to work on vmware environment in addition to
> all the other platforms.
> In vmware Hypervisor environment there is no support for system(), so I will
> not be able to use the same.
>   
Does it only allow one process? Vmware and hypervisor are not terms too
specific.
Is it a hardware hypervisor controlling the server?




reply via email to

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