Boost logo

Boost Users :

From: Persson Jonas (jonas.persson_at_[hidden])
Date: 2004-08-12 06:13:36


> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]]On Behalf Of Jeff Garland
> Sent: den 11 augusti 2004 17:19
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] Feature for using C++ as script language
>
>
> On Wed, 11 Aug 2004 11:33:50 -0300, Maurício wrote
> > Hi,
> >
> > After I discovered Boost, which has regex and filesystem
> > libraries, I decided to use C++ for tasks that I usually do with
> > Ruby (a Perl-like language), because I know C++ a lot better than
> > other languages. However, there's a feature of those languages I
> > miss: the ability to call external programs and get the output as a
> > string. Does any of Boost libraries (or other free libraries you
> > know) have this capability?
>
> There isn't a boost library, but it would be a nice addition.
> Turns out the
> 'system' call is available on both windows and unix so you
> can do something
> like this:
>
> #include <stdlib.h>
>
> std::string command = "...your command here..."
> std::string tmpfile_name("...your temporary file name here...");
> std::string cmd = command + "> " + tmpfile_name;
> system(cmd.c_str());
> std::ifstream output(tmpfile_name.c_str());
>
> Of course this has many limits an issues. If you want
> something more formal
> pstreams might work for you:
>
> http://pstreams.sourceforge.net/
>
> HTH,
>
> Jeff
>

Another one is here:
http://libexecstream.sourceforge.net/

        / Jonas


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net