Sorry for the delay in the answer.
That's it!. I never thought MSDN was going to be my friend, but yes.
There is a rather good example in:
http://msdn2.microsoft.com/en-us/library/edze9h7e%28vs.71%29.aspx

Thank you very much

2007/7/30, keith.d.marshall@ntlworld.com <keith.d.marshall@ntlworld.com>:
Jonathan Wilson wrote, quoting Luis Ramirez:
> > Do you know which #includes and libs are needed to include for these pipe,
> > fork, dup2 and exec functions, or other similar functions.
>
> Windows does not include a fork function. You will either need to rewrite
> your code to call windows specific process related functions such as
> CreateProcess ...

As Tuomo said, in another reply, MSDN is your friend.  So is our mailing list archive, for this question has already been answered several times before.

To replace pipe(), you may use Microsnot's _pipe(), but it isn't a direct replacement; you need to deal with different semantics.

The most direct replacement for fork()...exec??() is _spawn??(); it passes the argument list, just like exec??() does, through to CreateProcess(), but there are a couple of gotchas:

1) You have to save the parent's I/O context, and set up the I/O context for the child, within the *parent*; there is no opportunity for the child to set up its I/O context for itself, as you can do between fork() and exec??() in *nix.  Then, after spawning the child, the parent must restore its own I/O context.

2) Microsnot's _spawn??() and _exec??() functions are all broken, WRT grouping of arguments containing embedded white space.  To get around that, GPL programs may use our `execwrap' library:
https://sourceforge.net/project/showfiles.php?group_id=2435&package_id=82725&release_id=366538

If you can't, or won't use GPL, then you may not use that; you'll have to deal with building a properly quoted argument string, to pass to CreateProcess(), for yourself.

HTH,
Keith.

-----------------------------------------
Email sent from www.virginmedia.com/email
Virus-checked using McAfee(R) Software and scanned for spam


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
MinGW-users mailing list
MinGW-users@lists.sourceforge.net

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users