> is there a C++ method of calling an external executable program?
I know you can do it using C, but what about C++?
Here's one possibility you might find interesting (this was a quick
hack at overhauling some code I wrote _years_ ago that used an
ostrstream, so it might benefit from some cleanup):
#include <sstream>
#include <cstdlib>
using std::ostringstream;
ostringstream &execute(ostringstream &s)
{
std::system(s.str().c_str());
return s;
}
ostringstream &operator<<(ostringstream &s,
ostringstream &(*manip)(ostringstream &s))
{
return manip(s);
}
int main() {
ostringstream x;
x << "ls " << execute;
return 0;
}
If you want to see the original code, it's at:
http://groups-beta.google.com/group/...940ddf50edf667
I have to admit that until I looked at the date on that post, I hadn't
quite realized how old this really was. :-)
--
Later,
Jerry.
The universe is a figment of its own imagination.