On Sat, 11 Aug 2007 19:19:25 GMT, Erik Wikstr?m <Erik-wikstrom@telia.com> wrote:
On 2007-08-11 20:33, CodeGrommet wrote:
I'm testing out the system() command. I coded the following. How can
I output the results into the given output file? Your help will be
appreciated.
Generally, system() should be avoided. If you have to execute external
programs uses some of the platform-specific sys-calls designed for this
purpose.
I'd put it this way: if you're going to use system(), be aware how it
works on your target platforms. It's not trivial, with the
interactions with the Unix shell and everything ...
If you want to keep the code portable stick to the sys-calls
defined in POSIX, such as exec() etc.
But they are messy (and POSIX-specific).
Someone should (or maybe already has?) implement the popen/subprocess
stuff from Python -- some kind of limited portability, but also access
to the best the OS can provide.
quite easily.