On , Tom Torfs (2:292/516@fidonet) wrote:
RS> exec() is part of the Posix.1 standard, spawn() is DOS/Win-only.
> Isn't there a more essential difference ? Namely that exec() overlays the
> current program and therefore never returns, while spawn() may be used in
> that way but also so that it returns. At least that's the way it's
> implemented by Watcom and Borland.
Tom...
Precisely so. IOW, the spawn calls reflect their non-multitasking origins.
In a Posix.1 multitasking environment, you have lots of other tools such as
interprocess pipes and fork() calls to allow a much greater degree of
control. An example is used in the O'Reilly & Assoc. book, "The Posix
Programmer's Guide", in which a fork() call causes the subordinate process to
exec the "more" filter after setting up a pipe to send all future output from
the parent process to the child rather than to stdout. It's kinda contrived,
but it is an excellent example to cause the reader to start thinking of all
the things you can do with that degree of control.
--- QM v1.00
---------------
* Origin: MicroFirm : Down to the C in chips (1:106/2000.6)
|